Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Updating a combobox outside the load method


Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2003, 09:55 PM
MasterChief777's Avatar
MasterChief777 MasterChief777 is offline
Centurion
 
Join Date: Feb 2003
Location: Montreal, Canada
Posts: 187
Default Updating a combobox outside the load method


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.
__________________
VB World VB Tutorial site.
Reply With Quote
  #2  
Old 12-22-2003, 03:01 AM
Csharp's Avatar
Csharp Csharp is offline
Senior Contributor

* Expert *
 
Join Date: Jul 2003
Location: Ashby, Leicestershire.
Posts: 967
Default

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.
__________________
~~ please don't PM me regarding code, I only reply to personnal messages ~~
Reply With Quote
  #3  
Old 12-22-2003, 01:10 PM
MasterChief777's Avatar
MasterChief777 MasterChief777 is offline
Centurion
 
Join Date: Feb 2003
Location: Montreal, Canada
Posts: 187
Default

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:

Code:
dim frm as new Form1 me.owner=frm 'The mistake was here frm.variable=<new value>

I should have done this:

Code:
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.
__________________
VB World VB Tutorial site.
Reply With Quote
  #4  
Old 12-22-2003, 02:28 PM
Csharp's Avatar
Csharp Csharp is offline
Senior Contributor

* Expert *
 
Join Date: Jul 2003
Location: Ashby, Leicestershire.
Posts: 967
Default

you may wish to change this line ...
Code:
frm = me.owner
to this ...
Code:
frm = DirectCast(Me.Owner , Form1)
because you will get errors if you turn Option Strict ON , due to late binding.
__________________
~~ please don't PM me regarding code, I only reply to personnal messages ~~
Reply With Quote
  #5  
Old 12-22-2003, 03:06 PM
MasterChief777's Avatar
MasterChief777 MasterChief777 is offline
Centurion
 
Join Date: Feb 2003
Location: Montreal, Canada
Posts: 187
Default

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.
__________________
VB World VB Tutorial site.
Reply With Quote
  #6  
Old 12-22-2003, 03:12 PM
Csharp's Avatar
Csharp Csharp is offline
Senior Contributor

* Expert *
 
Join Date: Jul 2003
Location: Ashby, Leicestershire.
Posts: 967
Default

this msdn link will probably explain it better ...msdn article on Option strict
__________________
~~ please don't PM me regarding code, I only reply to personnal messages ~~
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Load combobox Jelmer Word, PowerPoint, Outlook, and Other Office Products 1 05-14-2003 07:38 PM
Need to Load a TXTFile into Combobox vbfan General 16 12-14-2002 07:13 AM
Combobox save and load textfile timbijkerk General 12 12-10-2002 07:59 PM
Filtering unique items MarkG General 24 08-18-2001 02:44 AM
Combo makes RTB`s visible? golash General 2 11-27-2000 03:16 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->