Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2008, 07:21 PM
Registered User
 
Join Date: Feb 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
Finally found this forum. I took your advice from 2004 and the above conversation. I created an object with "Description" and "Value" properties. Then I loaded these objects from an ENUM which contains text like ICE_Ice_And_Rain and populated the ComboBox with these. Still couldn't get the ComboBox to display "Value" after "Description" was selected so I CHEATED. I covered the ComboBox edit area with a TextBox which behaved as desired (I'm a student programer, and was totally frustrated after three days on this problem).

Here's code from LOAD.
Names = [Enum].GetNames(GetType(SystemNames.Systems))
For i = 0 To Names.Length - 1
     BrokenUp = Names(i).Split("_")
     For j = 1 To BrokenUp.Length - 1
         Description = Description & BrokenUp(j) & " "
     Next j
     Value = BrokenUp(0)
     cboSystems.Items.Add(New SystemNames(Description, Value))
     cboSystems.DisplayMember = "Description"
     Description = ""
Next i

Then the DropDownClosed code.
If cboSystems.SelectedIndex = -1 Then Exit Sub
     txtSystems.Visible = True
     txtSystems.Text = CType(sender.selecteditem, SystemNames).Value

Finally the TextBox GotFocus() code.
txtSystems.Visible = False
cboSystems.Focus()
cboSystems.Text = " " & txtSystems.Text

Thanks again,
Bill





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox Populating Delay aw23 Access VBA 24 June 8th, 2005 03:39 AM
populate data in a windows form combobox from a da anibiswas General .NET 0 March 4th, 2005 03:57 PM
Populating report or form textboxes Bosstone100 Access VBA 3 November 15th, 2004 03:53 PM
Populating a form maneor Access 1 September 30th, 2004 03:41 PM
Populating Combobox by Code Syed Afzal Ahmed ADO.NET 1 July 12th, 2003 03:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.