how do i get string into.........

  • Thread starter Thread starter Supra
  • Start date Start date
S

Supra

how do i get string into combobox? i am working on irc chat similar to
mirc.

i put in declaration section:

Dim szCommand() As String = {"ACTION", "JOIN", "PART", "QUIT",
"NOTICE", "KICK", "BAN", "INVITE", "TOPIC", "MODE", "AWAY", "CHAT",
"OTHER", "USER"}

and in sub new()

For iCommand As Integer = 0 To szCommand.Length
cboCommand.Items.Add(iCommand) ===> display 0 to 14
instead of string
Next
end sub

regards
 
Supra said:
how do i get string into combobox? i am working on irc chat similar to
mirc.

i put in declaration section:

Dim szCommand() As String = {"ACTION", "JOIN", "PART", "QUIT",
"NOTICE", "KICK", "BAN", "INVITE", "TOPIC", "MODE", "AWAY", "CHAT",
"OTHER", "USER"}

and in sub new()

For iCommand As Integer = 0 To szCommand.Length
cboCommand.Items.Add(iCommand) ===> display 0 to 14
instead of string
Next
end sub

regards
Use the integer as the subscript into your array of strings.
(warning. code is untested)
For i as Integer = 0 To szCommand.Length - 1
cboCommandItems.Add(szCommand(i))
Next

Note the differences. First the loop control restricts the repetitions to 14
(0 - 13) to match the number of strings in your array. Second, strings are
added to the combo box.

Hope this helps.
 
cboCommand.Items.Add(szCommand(iCommand))

how do i get string into combobox? i am working on irc chat similar to
mirc.

i put in declaration section:

Dim szCommand() As String = {"ACTION", "JOIN", "PART", "QUIT",
"NOTICE", "KICK", "BAN", "INVITE", "TOPIC", "MODE", "AWAY", "CHAT",
"OTHER", "USER"}

and in sub new()

For iCommand As Integer = 0 To szCommand.Length
cboCommand.Items.Add(iCommand) ===> display 0 to 14
instead of string
Next
end sub

regards
 
thank peter. i got it working
regards
Use the integer as the subscript into your array of strings.
(warning. code is untested)
For i as Integer = 0 To szCommand.Length - 1
cboCommandItems.Add(szCommand(i))
Next

Note the differences. First the loop control restricts the repetitions to 14
(0 - 13) to match the number of strings in your array. Second, strings are
added to the combo box.

Hope this helps.
 
* Supra said:
how do i get string into combobox? i am working on irc chat similar
to mirc.


i put in declaration section:

Dim szCommand() As String = {"ACTION", "JOIN", "PART", "QUIT",
"NOTICE", "KICK", "BAN", "INVITE", "TOPIC", "MODE", "AWAY", "CHAT",
"OTHER", "USER"}

\\\
Me.ComboBox1.Items.AddRange(szCommand)
///
 
Dim szCommand() As String = {"ACTION", "JOIN", "PART", "QUIT",
"NOTICE", "KICK", "BAN", "INVITE", "TOPIC", "MODE", "AWAY", "CHAT",
"OTHER", "USER"}

For iCommand As Integer = 0 To szCommand.Length

Instead of a for loop, call the AddRange method:

cboCommand.Items.AddRange(szCommand)


--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top