|
I want to check a submenu, but i dont want this menu closes after that.
¿how can i do this?
nada
modified on Monday, September 12, 2011 11:58 AM
|
|
|
|
|
I think you have to be a bit more specific. What kind of submenu , how do you call it.
Cheers,
|
|
|
|
|
Hello,
I am having on delegate declared in a dll as
public delegate Object InvokeMethod(ResponseHandler responseHandler, Object[] arguments);
initialized in constructor
public ResponseProxy(InvokeMethod invokeMethod, ResponseHandler responseHandler)
{
responseHandler_ = responseHandler;
invokeMethod_ = invokeMethod;
}
Now i want to call ResponseProxy from my C# class and my problem is that how to pass first param "invokeMethod".
If i am calling it from Form class then i can do this.Invoke and working fine like
ResponseProxy(this.Invoke, EnumToolsHandler, "EnumToolsHandler")
but what if i am calling it from any .cs class. It requires InvokeMethod and if i create a object of it how should i initialize it
Please tell me how can i sort it out.
Thanks in advance.
Gajesh
Pune(India)
|
|
|
|
|
Hi all:
I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change?
Nothend
|
|
|
|
|
Hi
Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name,
private void textBox_TextChanged(object sender, EventArgs e)
{
TextBox txt = (TextBox)sender;
MessageBox.Show("The Current TextBox is " + txt.Name);
}
All the TextBox's TextChanged events will share the above event.
Cheers,
Chandru.
|
|
|
|
|
Thanks.
but I'm sorry, as you said ,I will write 100 enents of XXX_TextChanged ?
What I care is the change,if any of the TextBoxes is changed,I will set a boolean variable false.So how to achieve that?Thanks!
Nothend
|
|
|
|
|
Write one forAll_TextChanged and add it to all textboxes. Can be done "manually":
textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged)
or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least).
Note that you have to have the proper format of the forAll_TextChanged method.
Internet - the worlds biggest dictionary
|
|
|
|
|
Thanks a lot ,it works!!!
Nothend
|
|
|
|
|
use the TextChanged event of the textbox
|
|
|
|
|
Hi I’m working on a system that has 4 different types of client they have mostly the same attributes so I decided to create an interface IClient for them to implement and then just add the differing attributes as needed to each client class.
Now I get the Client information from a DB and Load them into a Generic dictionary
The class looks like so
[code]
class Class1<T> : Dictionary<int, T> where T:IClient
{
private IndemnityScheme scheme;
public Class1(IndemnityScheme scheme)
{
this.scheme = scheme;
}
public int Load()
{
// "procIndemnityClientSelect";
DataBaseAccess dba = new DataBaseAccess(this.scheme);
SqlDataReader reader = dba.LoadData("procPrsymClientSelect");
SmartDataReader smartReader = new SmartDataReader(reader);
while (smartReader.Read()) {
AceClient newClient = new AceClient(this.scheme);
newClient.Clientshort = smartReader.GetString("Client Short Name");
newClient.Clientname = smartReader.GetString("Client Name");
newClient.Clientref = smartReader.GetInt32("client ref");
newClient.AddressLine1 = smartReader.GetString("Address Line 1");
newClient.AddressLine2 = smartReader.GetString("Address Line 2");
newClient.AddressLine3 = smartReader.GetString("Address Line 3");
newClient.AddressLine4 = smartReader.GetString("Address Line 4");
newClient.AddressLine5 = smartReader.GetString("Address Line 5");
newClient.AddressLine6 = smartReader.GetString("Address Line 6");
newClient.Telephone = smartReader.GetString("Telephone No");
newClient.PostCode = smartReader.GetString("post code");
newClient.Contact = smartReader.GetString("Contact");
// newClient.Handler = smartReader.GetString("Handler");
newClient.Joindate = smartReader.GetString("Join Date");
newClient.Leavingdate = smartReader.GetString("leaving Date");
newClient.Salutation = smartReader.GetString("salutation");
newClient.Email = smartReader.GetString("Email");
newClient.Comments = smartReader.GetString("comments");
base.Add(newClient.Clientref, newClient);
}
smartReader.Close();
smartReader = null;
dba = null;
return base.Count;
}
}
[/code]
I call the class in my program like so
[code]
AceClient c = new AceClient(IndemnityScheme.ACE);
Class1<AceClient> cl = new Class1<AceClient>(IndemnityScheme.ACE);
cl.Load();
foreach (AceClient ac in cl.Values) {
System.Diagnostics.Debug.WriteLine(ac.Clientshort);
}
[/code]
Nothing fancy just want to loop throught the collection but on trying to complie I get an error.
This is the line of code that errors
[code]
base.Add(newClient.Clientref, newClient);
[/code]
Error 24 The best overloaded method match for 'System.Collections.Generic.Dictionary<int,T>.Add(int, T)' has some invalid arguments
Error 25 Argument '2': cannot convert from 'Prsym.AceClient' to 'T'
Can anyone tell me what I am doing wrong??
|
|
|
|
|
Does AceClient implement the IClient interface? This error can occur because the class violates the conditions of the generic (in this case where T implements IClient).
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks for the reply yes the AceCLient does Implement ICleint.
I was hoping that
class Class1<t> : Dictionary<int,t> where T:IClient
would mean the Dictionary Type would be of the Type of the instantiate calls so in my instanace the dictionary would be Dictionary<int, aceclient).
this="" does="" not="" seem="" to="" be="" happen="" i="" have="" been="" able="" work="" around="" this="" by=""
="" class="" class1<t=""> : Dictionary<int,iclient> where T:IClient
It just means if i wish to access the collection by a class that implements ICLient i have to do the following casting
((AceClient)col[1]).Temp;
where col is the collection and Temp is and exdened property of AceCLient Not found in IClient
|
|
|
|
|
I begin learn C# i create 2 class connect.cs and Dataacess.cs
in Dataacess class I want to using connect class like VB.net Imports a class but error
using Connect;
i don't understand
Tell me about please
Thanks
quan
|
|
|
|
|
using is for namespaces. If your classes have the same namespaes, you don't need it. In fact, imports works the same way.
Connect c = new Connect();
will create an instance of the connect class for you.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi,
I have create a custom user control.How can i create the control dynamicly and put into a array.
any hits are welcome,
thanks in advance
cocoonwls
|
|
|
|
|
List<myUserControl> ctrls = new List<myUserControl>();<br />
<br />
myUserControl ctrl = new myUserControl();<br />
ctrls.Add(ctrl);<br />
<br />
life is study!!!
|
|
|
|
|
Please see the fillowing link. I think this will help you.
http://www.codeproject.com/useritems/DynamicServerControls.asp
asd
|
|
|
|
|
Dear All,
I assign memory to a parameter to store some information. I start with the value null for that parametr. After usage, I set the value back to null, but the memory assign to the parameter is not released. How do I destroy the parameter ? Any help is , as usual , highly appreciated.
private FormNetworking _fo;
public void pbNetworking_Click(object sender, System.EventArgs e)
{
if (_fo == null)
{
_fo = new FormNetworking();
_fo.Show();
_fo.FormClosed += new FormClosedEventHandler(fo_Closed);
}
else
{
_fo.Focus();
}
}
public void fo_Closed(object sender, FormClosedEventArgs e)
{
_fo = null;
}
kind regards,
|
|
|
|
|
If your object has a DIspose method, call it first. Otherwise, you have to wait for the GC to do it's thing.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thank you so much for your input.
Unfortunately it didn't do the trick. I invoke :
_fo.dispose();
before closing the form but the memory is not released. Every time I open a new instance of the form, it adds a little bit ( about 8 k ) to the memory.
|
|
|
|
|
Welcome to a GC system. Memory is released sometime in the future, there's nothing you can do, and nothing to worry about. Still call Dispose, tho.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I guess you're right. Even unmanaged resources eventually have to rely on the GC to get cleaned up.
thx for your anwser , I won't worry then
|
|
|
|
|
As Christian pointed out, welcome to a garbage collected world. At some point after your object is disposed, the GC will eventually free the memory. Calling Dispose only helps mark the object as collectible.
Rick van Woudenberg wrote: Even unmanaged resources eventually have to rely on the GC to get cleaned up
Unfortunately, the GC does not know how to free unmanaged resources. That is the reason to call Dispose when you are done using the object.
For a more detailed look at how to implement Dispose , check out the following article:
http://www.codeproject.com/useritems/idisposable.asp[^]
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Scott Dorman wrote: Calling Dispose only helps mark the object as collectible.
That's incorrect. Calling Dispose has nothing to do with garbage collection, it is required only to release the resources held by the object immediately. The GC only checks for references to an object to find out if it's eligible for collection.
|
|
|
|
|
You are correct...that statement was inaccurate. However, when the GC does collect an object it will call the Dispose method if it hasn't already been disposed.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|