Re: how do i get string into.........

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Peter van der Goes (p_vandergoes_at_toadstool.u)
Date: 08/19/04


Date: Thu, 19 Aug 2004 07:28:44 -0500


"Supra" <supra56@rogers.com> wrote in message
news:mR0Vc.1809004$Ar.1637085@twister01.bloor.is.net.cable.rogers.com...
> 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.

-- 
Peter [MVP Visual Developer]
Jack of all trades, master of none.


Relevant Pages

  • Re: K&R2 Secition 5.9 - major blunders
    ... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
    (comp.lang.c)
  • Re: K&R2 Secition 5.9 - major blunders
    ... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
    (comp.lang.c)
  • Re: Returning array of strings through callback from unmanaged to
    ... Is the array of strings a jagged array or fixed length array? ... It is imperative that I am able to return the array of strings from the ... I have control over how many strings I want the unmanaged code to return ... What I want to accomplish is to pass a callback function to unmanaged ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: attempting to return values from array from w/in a function
    ... What I get is an array w/ only the most recent array entry. ... I am new to PHP & do not have formal scripting ... you end up comparing strings, but the test you mean probably is simply: ... case 1: {codeblock} ...
    (comp.lang.php)
  • Re: K&R2 Secition 5.9 - major blunders
    ... Would changing 'point to a' to 'point into a' twenty element array be ... > arrays of pointers is to store character strings of diverse ... comparison between what was really happening (arrays of pointers to ... pointer to a string(this probably would confuse beginners)" and ...
    (comp.lang.c)