Visual Basic .Net List Box

VB.NET

    Next

  • 1. Lost in OO. (in VB.NET 2003)
    RG, A very simple way to begin with. (jroughly typed in this message In the label click event (I would use a button which appearance is set to flat) of your mainform dim frm as new extraform frm.ShowDialog label2.text = frm.LabelTextField frm.Dispose frm.LabelTextField is in your extraform Public LabelTextField as string. This you string you fill in the event from that radiobutton and than end of that event you set me.close I hope this helps, Cor
  • 2. Validate Text - Name, Phone Etc
    Hi, I am trying to find out if there is a good (Built-in?) way to validate text input. I would like to check a textbox to see whether user enter a proper name (without numbers, symbols etc) or if it is a valid phone number (no letters or symbols) etc or not. Right now I am sending the string to a subroutine that check it each letter at a time (looping) and tries to match it with pre-drfined chars using select case. This seems like very inefficient way of doing this. I would like to create these validation methods of a class and reuse them in all my programs. Any ideas? Thanks.
  • 3. Windows Installer / Setup
    Hello, I am making as setup/deployment project in Visual Studio.NET and would like to know how to change the top window and the Icon from the default icon of a computer to something I create. Is there a way to add a pic to the msi setup project? Thanks, Chuck

Visual Basic .Net List Box

Postby SGFuazEyMzQ » Sat, 02 Apr 2005 02:03:01 GMT

I am having a problem with a list box on a form. I have a list box that when 
I add items to it the text does not show up in the list box. I know thy are 
added because the side scroll bar changes and I can scrolll throught the list 
box. I can not figure out why the items are not being displayed. I have 
checked that the background color and the text color are different. Please 
let me know what else could be wrong


Re: Visual Basic .Net List Box

Postby Crouchie1998 » Sat, 02 Apr 2005 02:06:24 GMT

Show  the newsgroup the code you have & we'll see where you are going wrong



Re: Visual Basic .Net List Box

Postby OpticTygre » Sat, 02 Apr 2005 02:08:09 GMT

Are you positive you're adding type "text" to it?  The listbox.items.add 
method accepts a type "object" so it wouldn't produce an error if you tried 
to add something that was not text.  Could you provide some code from your 
application?

-Jason








Re: Visual Basic .Net List Box

Postby SGFuazEyMzQ » Sat, 02 Apr 2005 02:13:06 GMT

Here is the code I was testing with.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
        ListBox1.Items.Add("HELLO")
    End Sub








Re: Visual Basic .Net List Box

Postby OpticTygre » Sat, 02 Apr 2005 02:21:07 GMT

Nothing wrong with that as far as I can see.  Definately weird.  If I think 
of anything, I'll post back.  I'm not sure if any kind of system font 
changes or anything would affect it or not.

Try doing ListBox1.Items.Add(New String("Hello"))

That will most likely come up with the same result, but it's worth a shot. 
Sorry I can't be of more help on this one.

-Jason












Re: Visual Basic .Net List Box

Postby MeltingPoint » Sat, 02 Apr 2005 02:28:03 GMT

"=?Utf-8?B?SGFuazEyMzQ=?=" < XXXX@XXXXX.COM > wrote in








The code is fine. If you've been playing with the properties, check to 
make sure DrawMode is set to normal. Thats the only thing I can find 
that produces those results (Scrollbars showing, but no text)

MP

Re: Visual Basic .Net List Box

Postby Herfried K. Wagner [MVP] » Sat, 02 Apr 2005 02:30:40 GMT

"Hank1234" < XXXX@XXXXX.COM > schrieb:

Maybe the problem is caused by an unpatched virus scanner.  These symptoms
are typically caused by a McAfee VirusScan problem that NAI is aware of and
that can be fixed by installing a patch:

Patch 5 for McAfee VirusScan Enterprise 8.0i
<URL:https://knowledgemap.nai.com/phpclient/viewKDoc.aspx?url=kb/kb_kb38717.xml&docType=DOC_KnowledgeBase>

-- 
 M S   Herfried K. Wagner
M V P  <URL: http://www.**--****.com/ ;
 V B   <URL: http://www.**--****.com/ ; 


Re: Visual Basic .Net List Box

Postby SGFuazEyMzQ » Sat, 02 Apr 2005 02:41:04 GMT

I have tried the "ListBox1.Items.Add(New String("Hello"))" code but it 
produces the same result of no text but the scroll bars show up. I have also 
checked the properties of the list box and the DrawMode is set to "Normal". 
Even if I manually change the items (before runtime) it does the same thing. 
Any other ideas?










Re: Visual Basic .Net List Box

Postby SGFuazEyMzQ » Sat, 02 Apr 2005 02:49:01 GMT

Thank you for the link, we are running McAfee VirusScan Enterprise 8.0i
and it is fairly new to the enviroment. I will guess that this is the 
problem and will see why we do not allready have this patch. Thanks again.





Re: Visual Basic .Net List Box

Postby Crouchie1998 » Sat, 02 Apr 2005 03:14:07 GMT

Did you try removing the listbox from the form & then adding a new one. It
will keep the same default name, so, you won't need to alter your code. Does
that make any difference?

McAfee lets viruses through.. Symantec Antivirus 9.0 Corporate Edition is
far better!!



Re: Visual Basic .Net List Box

Postby SGFuazEyMzQ » Sat, 02 Apr 2005 03:51:08 GMT

The patch has solved the problem, thanks again. 





Similar Threads:

1.list boxes in visual basic .net

I am coding an application in .net using a list box.  I have the listbox 
property set to MultiSimple.  I can click on several different selections (or 
all) in the list box, but only the first one is the "active" one.  What I 
want to do is create an application that someone can order menu items from(I 
am a beginning .net programmer).  Here is my code that can allow one 
selection:
'defines structure
    Structure MenuItems
        Public strItem As String
        Public decPrice As Decimal
    End Structure
    'declare module level array 
    Dim mitmMenuItems(7) As MenuItems
    Private Sub frmsmoke_Load(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles MyBase.Load
        'fills mitmmenuitems array with menu items and prices from 
        'a sequential access file
        'declare variables
        Dim sreStreamReader As IO.StreamReader
        Dim intNumber As Integer

        Try     'turns on error trapping
            'creates a streamreader object by opening text file for input
            sreStreamReader = IO.File.OpenText("smoke.txt")

            'process loop instructions until end of loop is encountered or _
            'no more text to read
            Do Until sreStreamReader.Peek = -1 _
                OrElse intNumber >= mitmMenuItems.Length

                'reads an items price and assign to array with info on 
separate _
                'lines in the file
                mitmMenuItems(intNumber).strItem = sreStreamReader.ReadLine()
                mitmMenuItems(intNumber).decPrice = _
                    Convert.ToDecimal(sreStreamReader.ReadLine())

                'adds item to list box
                Me.lstorder.Items.Add(mitmMenuItems(intNumber).strItem)

                'updates array
                intNumber = intNumber + 1

            Loop

            'closes file
            sreStreamReader.Close()

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Smoke Shack BBQ", _
                MessageBoxButtons.OK, MessageBoxIcon.Information)
        End Try
    End Sub

    Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnexit.Click
        'closes app
        Me.Close()

    End Sub

    Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnclear.Click
        'clears controls
        Me.lblsub.Text = ""
        Me.lbltax.Text = ""
        Me.lbltotal.Text = ""
        Me.lstorder.ClearSelected()

    End Sub

    Private Sub btncalc_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btncalc.Click
        'searches array for item selected in lstorder control
        'declares variables
        Dim strSearchFor As String
        Dim intNumber As Integer
        Dim decItemPrice, decTotal As Decimal

        'initialize variable
        strSearchFor = Convert.ToString(Me.lstorder.SelectedItem)

        'add 1 to array subscript until items are located in array
        Do Until mitmMenuItems(intNumber).strItem = strSearchFor
            intNumber = intNumber + 1

        Loop
How can I go about adding multiple selections and adding up all selections 
to get a total price?  Right now, I have changed the .SelectedItem to 
.SelectedItems and it says that my array is out of bounds.

Any help would be appreciated, 
Thanks,
Dave

2.data bound list boxes in visual basic .net

Hey all,

I have a windows form with a list boxes. I have data bound the list boxes
with data from my sql database. I want to use drag and drop to allow users
to choose different options from the list boxes on the form and drag them
into another empty list box that is not bound to any data when the form
loads. I was wondering is it possible to use drag and drop with data bound
list boxes ? If it is possible do you know of  any place on the net that
shows a good example ?

P.S. I can implement drag and drop when the list boxes are not data
binded...

Thanks in advance!

Dwayne 


3.drag/drop with data bound list boxes in visual basic .net

Hey All,

I have been trying to implement drag and drop with data bound  list boxes . 
Does any one know if its possible?  I have been getting just the data row 
when ever I do the drag and drop or I have been getting the selected index 
number but I have not been getting the actually data item. I was thinking I 
might have to take the selected index number and use that to retrieve the 
actual data from the data set ?

Any help is much appreciated

Thank You,
Dwayne


4.Excel 2003 Visual Basic (List Box) in English not running in Germa

We developed an application in Excel 2003 with Visual Basic codes in English. 
 Our German prospective user has problem with the List Box.  The user is 
supposed to select chemical ions from the Selection box to the Selected Box.  
The ions could be selected or deselected to/from the list box.  Selected ions 
are then transposed to a Table on the Worksheet.  This is working in the 
English version.  However, the user seem to have problems in selecting & 
deselecting some of the ions.  Is there any special procedure without actual 
translation on our part for the English version to work properly in the 
german version.

The password input box is worikng.

Appreciate any help in this matter.

Thanks.

5.Excel 2003 Visual Basic (List Box) in English not running in G

Joel,,

It seems strange too.  Since I do not have a German version I can not really 
isolate the problem.  We run the program using a Japanese version and there 
was no error.  In fact my first thought was the interpretation of the 
subscript & superscript which I did not use in this case.

The VBs are a simple upload and selections for placement on another 
spreadsheet  where I do all the calculations.

One thought that came into mind is the Reference Library.  I used the Visual 
Basic for Application, MS Office Excel Object Library, Microsoft Forms.  I 
suppose if the version are different, that would cause a problem.

Thanks for your response.


 "Joel" wrote:

> I think you need to isolate the problem futher.  It is strange that some of 
> the IONs can be selected and others can't.  Are you using some change event 
> to automatically move the selected item to the box or are you using a button.
> 
> If you have a change event I would add a message box in the change event to 
> help isolate the problem.  See if the problem is the event stopped working or 
> if there is problems moving the data.
> 
> I'm thninking that the events are disabled because of some error, or the 
> German version isn't recognizing a change in the selected item.  If two IONs 
> get translated to German to the same Text then the German version may not be 
> recognizing the Text has changed.
> 
> "Lily" wrote:
> 
> > We developed an application in Excel 2003 with Visual Basic codes in English. 
> >  Our German prospective user has problem with the List Box.  The user is 
> > supposed to select chemical ions from the Selection box to the Selected Box.  
> > The ions could be selected or deselected to/from the list box.  Selected ions 
> > are then transposed to a Table on the Worksheet.  This is working in the 
> > English version.  However, the user seem to have problems in selecting & 
> > deselecting some of the ions.  Is there any special procedure without actual 
> > translation on our part for the English version to work properly in the 
> > german version.
> > 
> > The password input box is worikng.
> > 
> > Appreciate any help in this matter.
> > 
> > Thanks.

6. Slow Visual Basic File List Box on Windows 2000

7. pop-up box visual basic dot net and ASP dot net

8. Creating address list personal distribution lists with visual basic



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 42 guest