Page 1 of 1 1
Topic Options
#89715 - 2002-11-26 06:04 PM Reset contents of combobox
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Is there a way to replace the contents of a combo box...

basically, I have 1 combo box listing all the OUs in my domain, and upon click(change) I want it to update/replace the contents of a second combobox.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#89716 - 2002-11-26 06:41 PM Re: Reset contents of combobox
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Assign a OnClick or OnChange event to your 'parent' combobox. The event would then point to a function to populate the second combobox.
Top
#89717 - 2002-11-26 06:48 PM Re: Reset contents of combobox
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I have that... I need to empty the second box, if the first box is changed again
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#89718 - 2002-11-26 06:50 PM Re: Reset contents of combobox
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Here's some sample code...

code:
Break On CLS

$Form = CreateObject("Kixtart.Form")
$Form.Size = 220,100

$Combo1 = $Form.ComboBox(,20,30,200)
$Combo1.Top = 5
$Combo1.Left = 5
$Combo1.Additem (@WKSTA)
$Combo1.OnClick = "fnChangeBox()"

$Combo2 = $Form.ComboBox(,20,30,200)
$Combo2.Top = $Combo1.Bottom
$Combo2.Left = 5
$Combo2.AddItem (UserID1)
$Combo2.AddItem (UserID2)

$Form.Center
$Form.Show

While $Form.Visible
$nul=Execute($Form.DoEvents)
Loop

Function fnChangeBox()
$Combo2.Clear
$Combo2.AddItem (@USERID)
EndFunction


Top
#89719 - 2002-11-26 06:52 PM Re: Reset contents of combobox
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I guess the short answer is: "Clear"

Clear will empty the contents of whatever...be it a listview, combobox, etc.

Top
#89720 - 2002-11-26 06:57 PM Re: Reset contents of combobox
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
combo.clear

thanks [Smile]

In process of writing a kixform front end for remotely inventoring computers for help desk use. (mostly WMI based)

Including button to start SMS remote control/vnc
Macro buttons to execute common functions against remote PCs (copying specific files, rebooting, etc)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#89721 - 2002-11-26 07:03 PM Re: Reset contents of combobox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rad, might also want to check into pre-selecting an item from each list Two ways to do that:

Using index numbers:

$Form.Show
$Combo1.ListIndex = 0
$Combo2.ListIndex = 1

Using values:

$Form.Show
$Combo1.Value = @WKSTA
$Combo2.Value = UserID2

Little itty-bitty form there ... [Wink]

-Shawn

Top
#89722 - 2002-11-26 07:11 PM Re: Reset contents of combobox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Forgot to mention, depending on what you had in mind, might want to chnage the ComboBox style from DropDown (default) to DropDownList.

The DropDown style allows the user to select an item from the list, plus create their own item by editing the textbox.

The DropDownList style only allows the user to select an item from the list.

Style

ComboBox: Gets or sets a value specifying the style of the combo box. Valid values are as follows:

0 - Simple
1 - DropDownList
2 - DropDown

Top
#89723 - 2002-11-26 07:13 PM Re: Reset contents of combobox
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I was wondering about that...

Just need to display the contents, not try to accept input
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.06 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org