I have a form with a listbox controls that has some items in it.
When i double click a item from the listbox it opens a new form that as the title of the item.
(you will see that on some chat applications)
OK, code for the above is fine.
Now, i don´t want to open new forms with the same title, i want to prevent that.
If a form titled "bob" already exists and i double click "bob" item from the listbox, i want the existing form to be focused not open another form with same title!!!
Can anyone help me here?
how can i count forms, get their titles so that a can achive that
i suspect that i have to create some kind of mdiparent/child forms to do that.
you could keep a Dictionary<string,form> that maps titles to Forms, and before opening
a new Form, look for an existing one if any, then act accordingly. You would have to
remove entries when forms get closed then, using the Closed event.
Or use Application.OpenForms and search for a matching title.
I r multithreading! however it's not looking so good... I'm using a beginInvoke to fire off pings at other machines on my network I'm pulling the names from ldap sychronously. Anyways the question i had was "Are async delegates manged by the threadpool"... I thought i read somewhere that they were indeed managed via the threadpool... So next question is how come when i do something like this "ThreadPool.SetMaxThreads(10,10);" The app still fires off the max threads that the threadpool can manage? I.e. 20-25... Hope someone can shed some light on this.. Lemme know if you would like to see some code if that would help define my question/problem! Thanks in advance for any reply's even if it's stfu noobzor and go read a book!
I know the human being and fish can coexist peacefully. -George Dubya Bush
You can't cast an object to something that it isn't. You can only cast an object to it's actual class, any of it's base classes, or any of the interfaces that it implements.
C# is type safe, so the object contains information about it's actual type. When you do a cast, you cast the reference, but the object still remains the same type. Therefore, when you cast the DataTable reference to object, you get an object reference pointing to a DataTable object. You can't then cast this to msdatasrc.DataSource, as the actual type of the object does not inherit that class.
If the control can't use a DataTable as data source, you have to copy the data from the DataTable into something that the control can use.
Despite everything, the person most likely to be fooling you next is yourself.
My goal is to have a combo box for genders. I need the combo box to display the selected gender. Currently I have a class that has one of it's properties as gender. 1 is supposed to be male and 2 is female. However I am willing to do it however is best. I would like to incorporate binding since that is how I am doing the rest of my app. i.e. text boxes and datepickers etc
My problem is that the only thing I really know how to do in data binding is to drag an item from the data sources menu to a text box or a date time picker. Here the most important thing is the selection be the selection that has been chosen in the object. Ideally I can just use objects but if I have to I can go with xml, but either way I really need some direction.