Click here to Skip to main content
15,898,790 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionhow to use VSS--suggest the best approach Pin
pashitech27-Jun-07 19:48
pashitech27-Jun-07 19:48 
AnswerRe: how to use VSS--suggest the best approach Pin
koolprasad200327-Jun-07 20:41
professionalkoolprasad200327-Jun-07 20:41 
GeneralRe: how to use VSS--suggest the best approach Pin
pashitech27-Jun-07 20:56
pashitech27-Jun-07 20:56 
GeneralRe: how to use VSS--suggest the best approach Pin
pashitech27-Jun-07 20:57
pashitech27-Jun-07 20:57 
GeneralRe: how to use VSS--suggest the best approach Pin
pashitech27-Jun-07 20:57
pashitech27-Jun-07 20:57 
QuestionHow to control mouse and keyboard? Pin
re infecta27-Jun-07 19:47
re infecta27-Jun-07 19:47 
AnswerRe: How to control mouse and keyboard? Pin
Dave Kreskowiak28-Jun-07 4:38
mveDave Kreskowiak28-Jun-07 4:38 
QuestionName 'Listbox1' is not declared error Pin
jasontor27-Jun-07 19:47
jasontor27-Jun-07 19:47 
Hello all,

I'm new to VB, and I'm using VB5 Express and it's a great program tool. I also have some video tutorials for it. But unfortunately I'm having a problem using the snippet below:
http://www.a1vbcode.com/snippet-187.asp

When I create a form, and then add a button, then add the event for the button, then pasting in the code, I'm getting the dreaded

Name 'Listbox1', is not declared.

I'm not sure what I'm doing wrong, but I've looked for the answer, and I'm still stumped. Below is what the complete code looks like.

Public Class Form1
'Place the following code in a command button's click event

Private Sub cmdGetFilename_Click()

Dim sFilename As String
Dim sPath As String


'search for files with vbp extension
sPath = "c:\yourpath\*.vbp"
'use Dir$ to get first matching filename
sFilename = Dir$(sPath)

'retrieve remaining files matching the search pattern
'Dir$ returns zero length string when no match

Do While sFilename > ""

ListBox1.AddItem(sFilename)
'call Dir$ without parameters to get next filename
sFilename = Dir$
Loop

End Sub
End Class



----------------------------------------------------------------------------------------
Any help will be greatly appreciated, and thank you for your valued time.

Jason
AnswerRe: Name 'Listbox1' is not declared error Pin
CPallini27-Jun-07 21:58
mveCPallini27-Jun-07 21:58 
AnswerRe: Name 'Listbox1' is not declared error Pin
Dave Kreskowiak28-Jun-07 4:28
mveDave Kreskowiak28-Jun-07 4:28 
QuestionThe syntax about IDataReader? [modified] Pin
cateyes9927-Jun-07 15:37
cateyes9927-Jun-07 15:37 
AnswerRe: The syntax about IDataReader? Pin
TwoFaced27-Jun-07 18:45
TwoFaced27-Jun-07 18:45 
GeneralRe: The syntax about IDataReader? Pin
cateyes9927-Jun-07 19:31
cateyes9927-Jun-07 19:31 
Questionuhm hey ive got a question Pin
ricebowl0927-Jun-07 14:17
ricebowl0927-Jun-07 14:17 
AnswerRe: uhm hey ive got a question Pin
Christian Graus27-Jun-07 14:32
protectorChristian Graus27-Jun-07 14:32 
AnswerRe: uhm hey ive got a question Pin
Rupesh Kumar Swami27-Jun-07 19:15
Rupesh Kumar Swami27-Jun-07 19:15 
GeneralRe: uhm hey ive got a question Pin
Christian Graus27-Jun-07 19:40
protectorChristian Graus27-Jun-07 19:40 
GeneralRe: uhm hey ive got a question Pin
Rupesh Kumar Swami27-Jun-07 20:26
Rupesh Kumar Swami27-Jun-07 20:26 
GeneralRe: uhm hey ive got a question Pin
Mycroft Holmes27-Jun-07 22:46
professionalMycroft Holmes27-Jun-07 22:46 
Questionhow to create something similar to .htaccess Pin
uglyeyes27-Jun-07 13:49
uglyeyes27-Jun-07 13:49 
AnswerRe: how to create something similar to .htaccess Pin
Christian Graus27-Jun-07 13:58
protectorChristian Graus27-Jun-07 13:58 
QuestionData bound combo box in datagridview Pin
steve_rm27-Jun-07 11:30
steve_rm27-Jun-07 11:30 
AnswerRe: Data bound combo box in datagridview Pin
AlexeiXX327-Jun-07 11:57
AlexeiXX327-Jun-07 11:57 
Questioncontrast and sharpness change of image Pin
Mortezai27-Jun-07 7:44
Mortezai27-Jun-07 7:44 
AnswerRe: contrast and sharpness change of image Pin
Dave Kreskowiak27-Jun-07 7:57
mveDave Kreskowiak27-Jun-07 7:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.