MasterChief777
12-21-2003, 08:55 PM
Hi,
I'm writing a program where I have a combobox in a form. I can add items and determine its text in the form's load sub. But I can't do this afterwards. I use the combobox.items.add command and the combobox.text command but it doesn't change anything. Any ideas on how I can fix/get around this? Thanks.
Csharp
12-22-2003, 02:01 AM
are you trying to load the items from your existing form? or a different one?
maybe you can post how you are loading the items in the form's load sub. because you should have no trouble loading extra items after your load sub , unless something is upsetting it.
MasterChief777
12-22-2003, 12:10 PM
Thanks for replying. Actually the problem was that from a form I opened a second form. Then I tried to have the second form change some variables in the first form. The problem was the way I tried to access the first form from the second. What I did was something like this:
dim frm as new Form1
me.owner=frm 'The mistake was here
frm.variable=<new value>
I should have done this:
dim frm as new Form1
frm=me.owner
frm.variable=<new value>
Well, thanks for replying. Sorry if I confused anyone. I hope someone might at least be able to learn from my dumb mistake.
Csharp
12-22-2003, 01:28 PM
you may wish to change this line ...
frm = me.owner
to this ...
frm = DirectCast(Me.Owner , Form1)
because you will get errors if you turn Option Strict ON , due to late binding.
MasterChief777
12-22-2003, 02:06 PM
Thanks for the tip. While we're discussing it, could you please explain what Option Strict is all about? I'm still new at this.
Csharp
12-22-2003, 02:12 PM
this msdn link will probably explain it better :) ...msdn article on Option strict (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmoptionstrict.asp)