 |
 |
Index ‹ DotNet ‹ Visual C#.Net
|
- Previous
- 1
- 2
- Net Framework >> Timeouts are not supported exceptionI am trying to xml serialize an object but when I pass in a memory stream I
get an exception saying that "Timeouts are not supported by this stream."
Why are timeouts required? This happens when I compile with VS2k5 .Net 2.0.
It seems to work with .Net 2k3.
public void Serialize(Stream stream)
{
XmlSerializer serializer = new
XmlSerializer(typeof(MyObject));
XmlTextWriter writer = new
XmlTextWriter(stream,System.Text.Encoding.GetEncoding(1252));
serializer.Serialize(writer,this);
writer.Flush();
}
- 3
- 4
- Visual C#.Net >> Bug or by designConsidering the below code, is it a bug that I can return
IEnumerable<AnyType> instead of only IEnumerable<IFu> as constrained in
the base class?
It is not possible to add a constraint to the concrete class
implementation of GetStuff as it errors saying that it inherits the
superclass constraint(s) (which makes sense).
interface IFu
{
int GetValue();
}
abstract class A
{
public abstract IEnumerable<T> GetStuff<T>() where T : IFu;
}
class B : A, IFu
{
public override IEnumerable<T> GetStuff<T>()
{
return (IEnumerable<T>)new List<object>(); //should this
generate a compile time error?
}
public int GetValue()
{
return 0;
}
}
class Program
{
static void Main(string[] args)
{
B b = new B();
foreach (IFu fu in b.GetStuff<B>())
{
Console.WriteLine(fu.GetValue());
}
}
}
TIA,
JB
- 5
- Winforms >> Sync databound combobox to current bound record in formVS2005
I've been reading all the help I can on the topic (MSDN, other) but I
can't make sense of this.
Desired behavior;
The user is to choose from the displayed list of the databound combobox
and the coresponding 'Id' from the lookup table is to be inserted into
the field of the new record.
I have two simple tables. "tblPerson" is the data table. The lookup
table is "lkpPersonType".
The combobox dropdownstyle is "dropdownlist" to limit the user to the
list.
Here are the two tables
"tblPerson"
Id int IDENTITY (1, 1) NOT NULL ,
Name varchar(50),
Address varchar(50),
fkPersonTypeId smallint
"lkpPersonType"
pkPersonTypeId smallint IDENTITY (1, 1) NOT NULL ,
Type varchar(50) NOT NULL ,
The form has two binding sources "TblPersonBindingSource" for the data
table and "lkpPersonTypeBindingSource" for the lookup table.
The Display Member of the combobox is the "Type" field and the value
member is "pkPersonTypeId" field.
The Text property of the combobox is set to the "fkPersonTypeId" of the
table "tblPerson".
The next parts I am unsure of...
I did not set the Selected Value (???)
I set the Selected Item to the "Type" field of the lookup table
lkpPersonType
When I run the app the combobox populates. The data seems to display
properly for the first record, but the combobox does not cycle through
the values I know are assigned to it for the other records. In other
words it is not properly bound. However there is a relationship between
the two tables in the dataset, but the relationship is not specifically
refered to in the form.
Here is my code in the load event;
\\
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.TblPersonTableAdapter.Fill(Me.DataSet1.tblPerson)
Me.LkpPersonTypeTableAdapter.Fill(Me.DataSet1.lkpPersonType)
Me.FkPersonTypeIdComboBox.DataSource =
Me.lkpPersonTypeBindingSource
Me.FkPersonTypeIdComboBox.DisplayMember = "Type"
Me.FkPersonTypeIdComboBox.ValueMember = "pkPersonTypeId"
'Me.FkPersonTypeIdComboBox.SelectedValue = ???
'Me.FkPersonTypeIdComboBox.SelectedItem = "Type"
Me.FkPersonTypeIdComboBox.Text =
"TblPersonBindingSource.fkPersonTypeId"
End Sub
//
Please help me make some sense of this and get it working.
Thank you,
dbuchanan
- 6
- Dotnet >> visual studio update on winserver2003Hi fellows,
I am experiencing a problem while I try to update Visual Studio.NET 2003
on Windows Server 2003.
It tells me tha it is impossibile to connect to the update site. It
doesn't matter if I do it from the Visual Studio menu or from the
windows "add/remove applications" control panel applet.
I suspect it is due to the enhanced protection for Internet Explorer...
I do not want to disable it, I hope there's a way to "trust" Visual
Studio update site...
Windows Update works well...
Any suggestion is greatly appreciated.
Thanks in advance,
Andrea
- 7
- Dotnet >> Output Type missing from Project Properties pageHello,
I'm just learning C# on visual C# .net (my apologies if
this is not the apropriate forum for this question), and
I'm having a problem when I create empty windows
applications. Whenever I create an empty project it
automatically creates it as a console application,
instead of a windows application. There is supposed to
be an "Output Type" property in my project's property
pages that is attached to a compiler switch, but it
simply is not there. All the other properties are -
Assembly Name, Default Namespace, etc. Has anyone else
seen this phenomenon, and does anyone know how to fix
it? I'd really like to create practice programs without
the annoying consule window popping up first.
Thanks,
Nate
- 8
- Visual C#.Net >> IEnumerable<T>Hajo,
compiling below code I get following error:
Error 1 'ServerTreeConsoleApplication.ServerControlsTree' does not
implement interface member
'System.Collections.IEnumerable.GetEnumerator()'.
'ServerTreeConsoleApplication.ServerControlsTree.GetEnumerator()' is
either static, not public, or has the wrong return
type. E:\Work\Trials\ServerTreeConsoleApplication\ServerTreeConsoleApplication\ServerControlsTree.cs 7 18 ServerTreeConsoleApplication
Can someone explain me why?
thanks in advance for info
Gawel
public class ServerControlsTree : IEnumerable<ServerControl>
{
private ServerControl _root;
public ServerControl Root
{
get { return _root; }
set { _root = value; }
}
private ServerControl _enumerationRoot;
public ServerControl EnumerationRoot
{
get { return _enumerationRoot; }
set { _enumerationRoot = value; }
}
public IEnumerator<ServerControl> GetEnumerator()
{
List<ServerControl> controls = new List<ServerControl>();
controls.Add(_root);
for (int i = 0; i < controls.Count; i++)
{
yield return controls[i];
foreach (ServerControl childControl in
controls[i].Children)
{
controls.Add(childControl);
}
}
}
}
- 9
- Visual C#.Net >> UTF8 QuestionWhy does (in the code below) the message should appear as "keep-alive -
keep-alive - test" but it only appears as "keep-alive - keep-alive".
That is why the last comparation (Equals) isn't getting true. Is it
from the "Convert.ToByte('\0')" that does the comparation false?
I'm shure that the strings are identical but it gives me false. Why?
Any help is appreciated, (Possible some UTF8 compatibility issues?)
Nuno Magalhaes.
Here's the code:
***************************************************************
byte[] connectionBytes=new byte[16];
for(int i1=index+12,i2=0;;i1++,i2++)
{
if(bytes[i1]=='\n')
{
connectionBytes[i2]=Convert.ToByte('\0');
break;
}
connectionBytes[i2]=bytes[i1];
}
string strTemp=Encoding.UTF8.GetString(connectionBytes).ToLower();
MessageBox.Show("keep-alive - "+strTemp+" - test");
if(Encoding.UTF8.GetString(connectionBytes).ToLower().Equals("keep-alive"))keepAlive=true;
else keepAlive=false;
- 10
- Visual C#.Net >> Casting : example in VB.NETHi,
in VB.NET there is the following code:
Friend htProvidedProperties As New Hashtable()
Private Class TextboxValidatorProvidedProperties
Public DataType As DataTypeConstants
Public RegularExpression As String = String.Empty
End Class
'casting 1
Dim ProvidedProperties As
TextboxValidatorProvidedProperties = DirectCast
(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties)
'Casting2
Return DirectCast(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties).DataType
How can I do the casting (1 and 2) in C#?
I tried Convert.ChangeType(htProvidedProperties(ctrl),
TextboxValidatorProvidedProperties);
But it don't work (gives errors).
Thanks in advance
Vic
- 11
- Dotnet >> can't handleDear all,
I have a problem with a software I have created with .Net F1.1. I have
uninstalled an old version of the software and installed a new one.
Only 1 computer gives me the error:
"can't handle, there is something unexpected from the application"
I have tried to uninstall again and install again, change the name of the
assembly and other things, but I have no idea how to handle this problem,
that happens always and only for that computer.
Has anyone experience in this situation?
Thank you,
Bart
- 12
- ADO >> example of Inserting and Retrieving data from xml fileThis is an example of Inserting and Retrieving data from xml file.
http://www.hanusoftware.com
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!IsPostBack)
{
BindGrid();
}
}
private void BindGrid()
{
ds = new DataSet();
try
{
ds.ReadXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
}
catch(Exception ex)
{
throw ex;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
ds = new DataSet();
try
{
ds.ReadXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
DataRow row = ds.Tables[0].NewRow();
row["name"]=txtName.Text;
row["fathersname"]=txtFName.Text;
row["address"]=txtAddress.Text;
ds.Tables[0].Rows.Add(row);
ds.WriteXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
txtAddress.Text="";
txtFName.Text="";
txtName.Text ="";
BindGrid();
}
catch(Exception ex)
{
throw ex;
}
[url=http://www.hanusoftware.com] Software Development Company [/url]
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-ado-net/200709/1
- 13
- Dotnet >> VS.Net and HTML Form Field Level HelpWe are using Doc-to-Help 6.5 to produce HTML 1.x help for a Visual
Studio.Net Windows application. We want the Help files to remain on our
Intranet server. In my VS.Net project I've added a HelpProvider on each
form. I then set the Namespace to the http location of the .htm file related
to the form. When the user hits F1 voila the .htm page gets displayed in the
IE browser.
My question relates to context-sensitive help at the form field level. Is
there a way to reference the bookmarks within the .htm page (i.e.
http://...form.htm#firstfield) or does each form field need to have a
separate .htm file ? and such do I need to alter the Namespace each time
accordingly? This will place considerable burden on the Doc-to-Help team to
have to manage a file for each form field.
Any assistance in this design issue would be appreciated.
- 14
- Microsoft Project >> Remove resources from a projectI am new to Project so please help me: I have a project with some assigned
resources, they have done time cards for three months, now I wish to leave
some ones from it and assigne them to another project. How can I do it?
Thanks a lot...
Elisabetta
- 15
- Microsoft Project >> How can I track material cost and man hours for a finished job in.I want to build a project history for construction work that was allready
completed. I need to enter invoices for material use, rental equipment and
man hours. Has anyone developed an easy way to do this without all the extra
details that the wizard asks for? I am compiling past job history for my
neighbor who has a 2 year old construction firm.
Thanks Bob S.
|
| Author |
Message |
LeeBeck

|
Posted: Mon Dec 13 08:31:06 CST 2004 |
Top |
Visual C#.Net >> Outlook access Pop-up
Hi,
I have written a console application which accesses
emails stored on outlook and information about them into
SQL Server.
The program works but I have click yes to all the pop-ups
that appear to say another program is trying to access
outlook. Is there a way to stop this pop-up from
appearing as ideally I want to move this application onto
the server to work with exchange instead of the client
outlook.
DotNet388
|
| |
|
| |
 |
Peter

|
Posted: Mon Dec 13 08:31:06 CST 2004 |
Top |
Visual C#.Net >> Outlook access Pop-up
Hi,
Take a look at this link: http://www.outlookcode.com/d/sec.htm
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"W Akthar" <EMail@HideDomain.com> je napisal v sporocilo
news:168f01c4e115$c04a15a0$EMail@HideDomain.com ...
> Hi,
>
> I have written a console application which accesses
> emails stored on outlook and information about them into
> SQL Server.
> The program works but I have click yes to all the pop-ups
> that appear to say another program is trying to access
> outlook. Is there a way to stop this pop-up from
> appearing as ideally I want to move this application onto
> the server to work with exchange instead of the client
> outlook.
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Visual C#.Net |
- Next
- 1
- Dotnet >> Plugins and Late BindingHi,
I have some code to load some plug-ins, but the code requires me to know
the name of the class to load (here: SamplePlugin, derived from IPlugin) :
(Here is some C# code, but I use VB.Net to code my program)
using System;
using System.Reflection;
public class Driver
{
static void Main()
{
Assembly assembly = Assembly.LoadFrom ("myplugin.dll");
Type t = assembly.GetType ("SamplePlugin");
IPlugin plugin = (IPlugin) Activator.CreateInstance(t);
plugin.SayHello();
}
}
The problem is, I don't want to have to know the name of the class I want to
load... I want to load the new module and get an instance of the class that
derives IPlugin. Is there a way to do so?
In C++ for the same purpose, I had a win32 dll with an extern function that
returned an instance of the contained class, so I loaded the dll, called the
function and I was ready to proceed. Is there something similar I can do
with .NET class libraries?
thanks
- 2
- Visual C#.Net >> creating mailboxes on exchange 2003 clustersI use C# to connect a database with student information directly to the
Active Directory (2003). This means that as the student is enlisted an
account and mailbox is created in the active directory. Creating users is
flawless en mailbox creating went perfect against a single exhange server
using code from KB article 313114 of which part is displayed below.
mailbox = (IMailboxStore)user.NativeObject;
mailbox.CreateMailbox(homeMDB);
user.CommitChanges();
Now I need to let this code run against an exhange cluster and I can't get
it to work. It gives "There is no such object on the server" errors. I
personally think that somhow the homeMDB url is incorrect. But I can't find
any information on what the differences might be between the path on a
cluster or 'normal' exchange machine. I traced the path using ldap browsers
and it looks to be correct.
Any insights are welcome.
- 3
- Winforms >> File Open DialogI have a VB2005 program that has to import data from a 3.5 floppy drive and
USB drives. I use a file open dialog to choose the file, works great. The
problem occurs the next time I wish to open a file. If the last import was
done from a floppy drive the program looks for a floppy drive first and if
it has been removed I get an error. While I could just catch the error, I
would rather know how to avoid it. Something similar happens with USB
drives, if I import from a USB drive, the USB drive cannot be safely removed
until the program is ended. The initial directory of the file open dialog
is set to a C drive directory. It just seems that the program is not
releasing the last used drive until the program is exited. Can someone tell
me what I should do?
Thanks,
Thomas
With dlgFileOpen
.InitialDirectory = strAppPath & "Imports\"
.Multiselect = False
.Filter = strFilterExt
.FileName = strDefaultFile
.FilterIndex = 1
.Title = strOpenTitle
.ShowDialog()
End With
funGetFileName = dlgFileOpen.FileNames(0)
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
- 4
- Visual C#.Net >> Static Variables.Hi,
I have a pretty basic question.
I have a C# control with lots of classes and I need few instances(manager
classes) shared by all the classes in the conrol. So I define a Static Class
and it works OK.
Now When I want multiple instances of the control in the same application
and each instance to have it own set of manager instances, how do I do it?
Static is shared between the two instance of the control, which I want to
avoid.
Is there a specific variable type or a standard design pattern for it?
Thanks & Regards,
Gobi.
- 5
- Visual C#.Net >> ClickOnce including filesI have an application that is deployed with ClickOnce. The app has uses some
Crystal Reports files but they are not part of the application, but just
stored in a Reports directory. They are not classes within the project.
To display a report, the program
1. Gets a reference to the file from the selection in a dropdown box
2. Creates/instantiates a report document
3. Loads the the report into the document rptDoc.load(<file path>)
4. does some stuff (authentication,parameters, ect)
5. Assigns it as the ReportViewer's report source
works fine, but when I add the rpt files to the project, it wants to treat
them as reports and create a class for each with a code file.
I just need to get the report files copied to the app data directory when
the app is deployed so I don't have to rewrite all the code.
Can anyone suggest how to do this??
tia
Walter
- 6
- Microsoft Project >> Fill "Resource Usage" View using VBAHi,
I'm trying to fill the "Resource Usage" View with some data imported from
Excel or Clipboad.
To figure out how this works I recorded some macros and tried to understand
the vba code generated.
I understand what codelines like the following mean:
ActiveProject.Resources.UniqueID(1).Assignments.UniqueID(2097156).TimeScaleData(StartDate:="18.12.07 00:00", EndDate:="19.12.07
00:00", Type:=8, TimeScaleUnit:=4, Count:=1).Item(1).Value = "8"
But I have no idea how the "Assignments.UniqueID(2097156)" ist generated.
What ist the logic behind this 7-digit number? First I was thinking about a
time- or date-code..
Or is there any other possibility to fill this form, without knowing this
UniqueID 7-digit number?
THX in advance
cu Markus
- 7
- Visual C#.Net >> Simple Color Pallete control?I need a simple color pallete control, similar to one that exists in
appearance section in dialog properties. Here is a screenshot:
http://tinyurl.com/y6m78k
I tried using ColorDialog but there doesn't seem to be a way to have only a
couple of colors displayed. Is there a way to customize ColorDialog so that
it only displayes several colors I chose? If not I would appreaciate if
somebody could give me a few pointers on how to create such a control
myself. Thanks in advance.
James
- 8
- Dotnet >> Performance Counter not workingHello,
I wrote an application in c# .net 2.0. The application monitors the network
speed of a networkinterface. If I install the application at another pc with
the .net framework installed, the application won't run. The performance
counter can initialize itself but the value of bytes recieved for example is
always 0.
What should I do? Thanks
- 9
- Net Framework >> Can "InitializeComponent()" info be capturedHi there,
Don't know if I picked the correct NGs or not but maybe someone can steer me
in the right direction. Does anyone know if a class exists to capture the
same info now wrapped in "InitializeComponent()". I want to capture all form
details for a given form at design time (properties and controls) but I
can't find anyway to do it. Note that reading a form's ".resx" files won't
do either (it's only good for localized forms but in any case, it doesn't
always provide complete info). Thanks very much.
- 10
- Visual C#.Net >> Release build error LNK2019Hi,
I think it is a FAQ but I found no answer to my problem.
I created a C# program that called some C++ legacy code.
I created 2 projects :
1) a DLL (IPRCommWrapper.dll) including an unmanaged C++ wrapper for
legacy code and a managed C++ wrapper to allow C# to call this unmanaged
wrapper
2) a C# Win application
In Debug mode, everything works fine.
When I try to build in release mode, I have the following error :
"libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup".
here is the output from the build log :
Creating temporary file
"c:\Projects\IPRManaged\IPRCommWrapper\Release\RSP000017.rsp" with
contents
[
/OUT:"C:\Projects\IPRManaged\Release\IPRCommWrapper.dll" /INCREMENTAL:NO
/NOLOGO /DLL /DEBUG
/PDB:"C:\Projects\IPRManaged\Release/IPRCommWrapper.pdb" /NOENTRY
/FIXED:No /noentry nochkclr.obj mscoree.lib pcomm.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Program
Files\Microsoft Visual Studio .NET 2003\Sdk\v1.1\Lib\mscoree.lib"
- 11
- Visual C#.Net >> interface implementation and inheritance.Is it a good idea(or is it possible) for to implement half an
interface in base class and half in derived class.
e.g Interface IMyinterface has 3 properties.
Class B and C inherit class A, and implement implement IMyinteface.
Class A implements Propety1 of the interface IMyinterface
and class B and Class C implement property 2 and 3.
- 12
- ADO >> RecordStateChanged Object reference not set to an instanceObject reference not set to an instance of an object.
at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState
oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState
oldState2, DataViewRowState newState2)
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMerge)
at System.Data.DataRow.SetNewRecord(Int32 record)
at System.Data.DataRow.EndEdit()
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Lumedx.CardioDoc.UDF.CheckBoxAdapter.checkBox_CheckStateChanged(Object
sender, EventArgs e)
I get the above exception when I try to change the value of a column of a
data row view in the CheckStaeChanged event. The column is the same one the
checkbox's CheckState is bound to.
- 13
- ADO >> Connection Pool error.I am getting the following SQL exception:
Error: ReadSessionData: Error 1 - Type:
System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: System.Data.SqlClient.SqlInternalConnection
GetConnection(Boolean ByRef)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.ConnectionPool.GetConnection
(Boolean& isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledCon
nection(SqlConnectionString options, Boolean&
isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at visa.dps.ppc.data.SessionInfoRequest.Execute()
The root seems to be a General network error. Does anyone
know the cause? I can connect with the database with
Enterprise Manager and the database seems intact. I can't
figure out why I am getting this error. It seems to occur
the most when I install a new version of my application.
Once the application runs once without error it seems that
this error goes away. Any ideas?
Thank you.
Kevin
- 14
- Net Framework >> Application.RunHi
I have an app which starts using Application.Run(...........);
I want to create a logon screen, prior to the main app running, so I
modified my main() to look similar to
frmLogon logon = new frmLogon();
logon.ShowDialog();
//Check for valid logon
// If valid logon, start the main app
Application.Run(new frmMain());
logon=null;
My question is..... why do I need to use Application.Run ??
Should my logon prompt reside IN the application.run form, or outside it??
Thanks
Paul
- 15
|
|
|