Wrox Programmer Forums
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2009, 11:00 AM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question TextBox to ListBox show

Code:
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click


        'MessageBox.Show(txtPerson.Text.ToString)
        'this messagebox works when I run it


        'please can you help me to show text in listbox?
        
       lstDisplay.Show.txtPerson.Text.ToString()
        'the error Expression does not produce a value


    End Sub
End Class
 
Old September 3rd, 2009, 12:28 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default Clarify please...

can you be a little more clear as to what you are trying to do? are you trying to add the text of a text box to a listview? or highlight a listview item based on text in a textbox?
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old September 3rd, 2009, 12:35 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Red face Listbox

I am trying to show the value in textbox in listbox
 
Old September 3rd, 2009, 12:39 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default How about this..

How about something like this?

ListView1.Items.Add(TextBox1.Text)
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old September 3rd, 2009, 12:46 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Default Listbox

I have tried that and got 2 errors

Error 1 Property access must assign to the property or use its value.
Error 2 Name 'Items' is not declared.
 
Old September 3rd, 2009, 01:07 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default Hmm...

It works fine for me I just tested it?

Is lstDisplay a ListView object or is it a Form? because it looks almost as if it's a Form?

if that's the case then you need

lstDisplay.Show()
lstDisplay.ListView1.Items.Add(txtPerson.Text)
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old September 3rd, 2009, 01:21 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Angry Listbox

It Was me I had it wrong like this

lstDisplay(Items.add(txtPerson.Text))

When it should have been like this

lstDisplay.Items.Add(txtPerson.Text)

Thank you so much for your help just beginning it should get better

Headworth





Similar Threads
Thread Thread Starter Forum Replies Last Post
Memo field doesn't show in Listbox Grafixx01 Access 2 May 31st, 2007 07:16 PM
listbox/Textbox/sql Rudner VB How-To 0 March 9th, 2005 02:44 AM
Listbox/textbox johnjohn Classic ASP Basics 4 December 11th, 2004 12:14 AM
Listbox to textbox Freddyfred Access VBA 2 May 10th, 2004 10:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.