|
If the other application is another C# app you created, you can
use get property.
"To teach is to learn twice"
|
|
|
|
|
|
I have a function that does the following
fills a dataadapter with items belonging to user1
then Creates a dataset object and fills it with data using data adapter's Fill method
set my dataview = Nothing
then I fill a dataview with this dataset
lastly I bind a datagrid to this dataview
this works but next time I call my function for user2
the grid displays items belonging to both user1 and user2 instead of just user2
I am .Net Windows Application
How do I successfully clear the datagrid of user1 data before loading user2
some sample code would help since I am pretty new to .Net 
|
|
|
|
|
can you show sample code of what your doing. It sounds like its pointing to the binding context of user1 or your not pointing to user2's table.
Is this on the same form?
Have you used debug->locals and viewed which dataset and table its tied to?
Have you reset the datasource?
DataGrid1.DataSource = DataSet.Table["myuser2table"].DefualtView;
hmmm
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi !
I have a problem with serializing a class, which has a variable with an abstract-class-type.
If I'm using the specific class Test2, everything works fine,
but when I use the abstract class Test, I get the following error-message:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There was an error generating the XML document.
Does anybody know whats the matter here?
using System;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
namespace xmlTest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
myObject o = new myObject();
XmlSerializer mySerializer = new XmlSerializer(typeof(myObject));
StreamWriter myWriter = new StreamWriter("test.xml");
mySerializer.Serialize(myWriter, o);
}
}
public class myObject
{
//public Test2 t = new Test2();
public Test t = new Test2();
}
public abstract class Test
{
public string s = "Test";
}
public class Test2:Test
{
new public string s="Test2";
}
}
Thank you !!!!
|
|
|
|
|
Try adding a parameter-less constructor to your custom objects - the Xml serializer cannot work without one, e.g.
public class myObject<br />
{<br />
public Test t;<br />
public myObject()<br />
{<br />
t = new Test2();<br />
}<br />
}
|
|
|
|
|
The XmlSerializer works by creating an instance of the type and setting the various properties/fields. Because you have an abstract class it cannot create an instance of it and thus fails.
Using a real serializer (BinaryFormatter or SoapFormatter) will result in some extra information being written out so that the formatter knows the t field is a reference to an instance of the non-abstract class Test2 .
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Hi I have two .net applications running on the same PC. (its a long story.) I need to do a little bit of communication. I've read that Remoting is the way to do this, but all the examples for remoting involve three applications where one is a server, and tcp connections, and complicated stuff I don't need. Is there like a simpler thing I can do?
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Bog,
Let me suggest the following book on remoting:
"Advanced .Net Remoting" C# Edition by APress ISBN 1-59059-025-2
You can implement remoting between your two applications without the need of a "server" application. This means that your two applications each act as a client and a server to each other. This requires that each application in acting as a server must be on a different port number. Beware of UI Controls responding to remoting calls as they are handled on a seperate thread. UI control methods can only be accessed by the "creator" thread which is the application thread.
While Remoting in .Net is made simple, it still requires a good understanding of the details to build proper remoting components.
Happy coding!
|
|
|
|
|
|
I have been writing a few user controls, and have needed to put many of the same dropdownlist and other data dynamicly populated from a database.
I had an idea that maybe if I could somehow create a class that could access the database, load the DDL and then put is a placeholder, or pass back the populated DDL that I could start reusing more of my code.
Is this possible, or do I just pass back an array of data to bind, and if so how would I code the Val, Desc for the databind in an array. I am a little new to C# or C for that matter.
Thanks for any ideas and examples.
NamoGuy
Mike Stone
Kaskaskia College
|
|
|
|
|
just implement the IList which an array does ( the collection namespace) or System.Arrayy
of coursew you could create a class and implement the IDataBinding class for adding and things like that but the IList suffices
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
this seems like it should be really basic, .. but i do not understand the problem.
<br />
public int GetInt()<br />
{<br />
return 1;<br />
}<br />
<br />
public bool TestInt()<br />
{<br />
if( GetInt() > 0 )<br />
return true;<br />
return false;<br />
}<br />
error: An object reference is required for the nonstatic field, method, or property 'test.numbers.GetInt()'
|
|
|
|
|
Presumably you're calling test.numbers.TestInt() in a static (class) context rather than an object context. Either make TestInt() and GetInt() both static, or call them as methods of an object of type test.numbers.
|
|
|
|
|
Hi, How can I implement a windows form which does not steal the focus of the activated windows? Can you help me. Thank you!
|
|
|
|
|
AFAIK, with Forms, you can pop them up by either using .Show or .ShowDialog.
While ShowDialog makes the form modal (i.e. until you close it, you can't get back to the parent form), I think .Show is modeless (i.e. you can click on the parent form and use that while the child form is still open).
[Note: I might have the "modal" and "modeless" terms backward :-]
However, I think that when you open a form, the new form gets focus anyway.
HTH,
FOR
|
|
|
|
|
Thank you in advance. but, I want that windows form can not be activated, it does not take the input focus. Is there any Windows API could does that.
|
|
|
|
|
Hktam wrote:
I want that windows form can not be activated, it does not take the input focus. Is there any Windows API could does that
Hmm... not that I know of,
but you could intercept the onFocus event... ?
I got to try and see if it is possible,
but that's what I'd look at:
when the form gets focus, let the parent form (or whatever else)
get focus.
HTH,
FOR
|
|
|
|
|
Thank you in advance. Some windows forms like IME windows or MS intelliSense pop-up windows, they do not take the input focus, that kind of windows form is what I want for.
|
|
|
|
|
Hi,
Iam using EventLog Trace Listener. My question is how can I set the
trace level in the event log for example if the trace level is Error
the message displayed in the event log should have red cross icon with it.
Thanks,
Rinks.
|
|
|
|
|
Hi, I'm writing a user control that is basicly a collapsable panel. I would like the client to be able to insert the control into their form, and expand and collapse the control. The control expands/collapses when you click on the top part of it when you run the application, but when you click on it in the .NET form editor, it just selects it.
How do I make it functional in the form editor, like the tab control, where you can click on tab pages?
Thanks in advance,
Dave
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
Dave Kerr wrote:
How do I make it functional in the form editor, like the tab control, where you can click on tab pages?
Are you overriding the WndProc and catching the proper messages?
-Nick Parker
|
|
|
|
|
No, i'm not override WndProc, which messages should I be catching?
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
Yes. I have all three (VC6, VS.NET and VS.NET2003) all running on the same machine.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I thought it was 2002 and 2003?
Anyways, yes you can, but you have to be careful. Once you open a project/solution in VS 2003, you can't open it in VS 2002 anymore.
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|