|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Accessing Properties within a Panellabel, and eight combobox controls; and finally a button named "Apply." The label controls are sequentially named Channel0 through Channel7, and the combobox controls are sequentially named Ch0 through Ch7, accordingly. Each combobox contains four items out of which one must be selected. For example, lets say we choose Channel3 and the corresponding combox box drops down with these choices: Analog State Counter Pdm After any or all Channels have been configured, I want to use the Apply button's click event to process the selections. My question is, "From within the APPLY buttons click event code, how can I determine what item each of the eight combobox controls contain? (I'm kind of thinking in terms of finding some way to index through each of the comboboxes using a loop structure, but I don't see any index value for the combobox controls in the panel.) Thanks for helping this novice. Ally,
Combobox.text (do not forget to set them initial to Selectedinded = 0) As well to set them to dropdownlist I hope this helps, Cor Show quoteHide quote <ally> schreef in bericht news:8cb332l0htfq0jd1ttcnq28t10h4vo02ua@4ax.com... > In VB 2K5 Express I've created a panel named "Configure" with eight > label, and eight combobox controls; and finally a button named > "Apply." > > The label controls are sequentially named Channel0 through Channel7, > and the combobox controls are sequentially named Ch0 through Ch7, > accordingly. > > Each combobox contains four items out of which one must be selected. > For example, lets say we choose Channel3 and the corresponding combox > box drops down with these choices: > > Analog > State > Counter > Pdm > > After any or all Channels have been configured, I want to use the > Apply button's click event to process the selections. > > My question is, "From within the APPLY buttons click event code, how > can I determine what item each of the eight combobox controls contain? > > (I'm kind of thinking in terms of finding some way to index through > each of the comboboxes using a loop structure, but I don't see any > index value for the combobox controls in the panel.) > > Thanks for helping this novice. > > >
Show quote
Hide quote
<ally> wrote in message news:8cb332l0htfq0jd1ttcnq28t10h4vo02ua@4ax.com... You can iterate through the controls on the Panel using the following:> In VB 2K5 Express I've created a panel named "Configure" with eight > label, and eight combobox controls; and finally a button named > "Apply." > > The label controls are sequentially named Channel0 through Channel7, > and the combobox controls are sequentially named Ch0 through Ch7, > accordingly. > > Each combobox contains four items out of which one must be selected. > For example, lets say we choose Channel3 and the corresponding combox > box drops down with these choices: > > Analog > State > Counter > Pdm > > After any or all Channels have been configured, I want to use the > Apply button's click event to process the selections. > > My question is, "From within the APPLY buttons click event code, how > can I determine what item each of the eight combobox controls contain? > > (I'm kind of thinking in terms of finding some way to index through > each of the comboboxes using a loop structure, but I don't see any > index value for the combobox controls in the panel.) > > Thanks for helping this novice. > > (warning: Air code - not tested) For Each cal as Control In Configure.Controls If TypeOf cal is ComboBox Then 'Do whatever you need to do with the ComboBoxes. End If Next I hope this helps. -- Al Reid Al Reid wrote:
Show quoteHide quote > <ally> wrote in message news:8cb332l0htfq0jd1ttcnq28t10h4vo02ua@4ax.com... You're wondering what happened to control arrays, right?> > In VB 2K5 Express I've created a panel named "Configure" with eight > > label, and eight combobox controls; and finally a button named > > "Apply." > > > > The label controls are sequentially named Channel0 through Channel7, > > and the combobox controls are sequentially named Ch0 through Ch7, > > accordingly. > > > > Each combobox contains four items out of which one must be selected. > > For example, lets say we choose Channel3 and the corresponding combox > > box drops down with these choices: > > > > Analog > > State > > Counter > > Pdm > > > > After any or all Channels have been configured, I want to use the > > Apply button's click event to process the selections. > > > > My question is, "From within the APPLY buttons click event code, how > > can I determine what item each of the eight combobox controls contain? > > > > (I'm kind of thinking in terms of finding some way to index through > > each of the comboboxes using a loop structure, but I don't see any > > index value for the combobox controls in the panel.) > You can iterate through the controls on the Panel using the following: That works. Or, you can even create your own control array! Remember,> (warning: Air code - not tested) > > For Each cal as Control In Configure.Controls > If TypeOf cal is ComboBox Then > > 'Do whatever you need to do with the ComboBoxes. > > End If > Next Control is a class like any other, so there's nothing stopping us creating an array of Control, or even of ComboBox: 'at form level Private panelCombos() As ComboBox 'at form Load panelCombos = New Combobox() { Ch0, Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7 } 'when we want to read the values Dim iCombo As Integer For iCombo = 0 To panelCombos.Length - 1 DoSomethingWith panelCombos(i).SelectedItem Next -- Larry Lard Replies to group please
Show quote
Hide quote
On 4 Apr 2006 07:51:51 -0700, "Larry Lard" <larryl***@hotmail.com> Thanks, Al ... mission accomplished on that one. While speaking ofwrote: > >Al Reid wrote: >> <ally> wrote in message news:8cb332l0htfq0jd1ttcnq28t10h4vo02ua@4ax.com... >> > In VB 2K5 Express I've created a panel named "Configure" with eight >> > label, and eight combobox controls; and finally a button named >> > "Apply." >> > >> > The label controls are sequentially named Channel0 through Channel7, >> > and the combobox controls are sequentially named Ch0 through Ch7, >> > accordingly. >> > >> > Each combobox contains four items out of which one must be selected. >> > For example, lets say we choose Channel3 and the corresponding combox >> > box drops down with these choices: >> > >> > Analog >> > State >> > Counter >> > Pdm >> > >> > After any or all Channels have been configured, I want to use the >> > Apply button's click event to process the selections. >> > >> > My question is, "From within the APPLY buttons click event code, how >> > can I determine what item each of the eight combobox controls contain? >> > >> > (I'm kind of thinking in terms of finding some way to index through >> > each of the comboboxes using a loop structure, but I don't see any >> > index value for the combobox controls in the panel.) > >You're wondering what happened to control arrays, right? > >> You can iterate through the controls on the Panel using the following: >> (warning: Air code - not tested) >> >> For Each cal as Control In Configure.Controls >> If TypeOf cal is ComboBox Then >> >> 'Do whatever you need to do with the ComboBoxes. >> >> End If >> Next > >That works. Or, you can even create your own control array! Remember, >Control is a class like any other, so there's nothing stopping us >creating an array of Control, or even of ComboBox: > >'at form level >Private panelCombos() As ComboBox > >'at form Load >panelCombos = New Combobox() { Ch0, Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7 } > >'when we want to read the values >Dim iCombo As Integer >For iCombo = 0 To panelCombos.Length - 1 > DoSomethingWith panelCombos(i).SelectedItem >Next control arrays, I also need to create a "cellular" control array. In this panel I have 8 rows by 5 columns and each cell has a textbox control. So there are 8 * 5 = 40 cells. How could I modify your technique to include a double dimension to fit this scenario? Namely something like: panelCombos = New Combobox(m,n) {textbox(m,n) } is what I was thinking of, which is just a wild guess on my part. Thank you very much for your insight!
Dynamic DataGridView missing horizontal scrollbar
Suggestions to reduce memory use when splitting a string How do you use an unbound DataAdapter? Dummy question Easy One: Bind a Text Box to a an Integer Variable Can't get rid of references Inheritance Using PLink interactively as a Telnet process with VB.Net 2003 Reflection Question and MDI question Form Focus |
|||||||||||||||||||||||