473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

listbox undeclared.

I KEEP GETTING THIS ERROR
ListBox1 clear undeclared

please kindly look through my coding.


Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim X As Integer
Dim Y As Integer
Dim multiplication As Integer


X = CInt(TextBox1.Text)
Y = CInt(TextBox2.Text)

For X = 1 To 12
multiplication = X * Y
ListBox1.Items.Add(X & "X" & Y & "=" & multiplication)

Next
End Sub
End Class
Dec 5 '11 #1
3 1376
Rabbit
12,516 Expert Mod 8TB
It means that you don't have an object with the name ListBox1
Dec 5 '11 #2
Please teach me how can i declared it.
here is my full command.


<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.Button10 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(214, 32)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(45, 22)
Me.Button1.TabIndex = 0
Me.Button1.Text = "<<"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(214, 68)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(45, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = "<<"
Me.Button2.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(265, 31)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(42, 24)
Me.Button3.TabIndex = 2
Me.Button3.Text = ">>"
Me.Button3.UseVisualStyleBackColor = True
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(265, 68)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(42, 23)
Me.Button4.TabIndex = 3
Me.Button4.Text = ">>"
Me.Button4.UseVisualStyleBackColor = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(90, 31)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
Me.TextBox1.TabIndex = 4
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(90, 66)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(100, 20)
Me.TextBox2.TabIndex = 5
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(30, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(14, 13)
Me.Label1.TabIndex = 6
Me.Label1.Text = "X"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(30, 73)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(14, 13)
Me.Label2.TabIndex = 7
Me.Label2.Text = "Y"
'
'TextBox3
'
Me.TextBox3.Font = New System.Drawing.Font("Lucida Fax", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox3.ForeColor = System.Drawing.Color.DarkSlateGray
Me.TextBox3.Location = New System.Drawing.Point(33, 122)
Me.TextBox3.Multiline = True
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(154, 247)
Me.TextBox3.TabIndex = 8
'
'Button5
'
Me.Button5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button5.ForeColor = System.Drawing.Color.DarkRed
Me.Button5.Location = New System.Drawing.Point(193, 122)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(127, 23)
Me.Button5.TabIndex = 9
Me.Button5.Text = "Clear All"
Me.Button5.UseVisualStyleBackColor = True
'
'Button6
'
Me.Button6.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button6.ForeColor = System.Drawing.Color.Crimson
Me.Button6.Location = New System.Drawing.Point(193, 151)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(127, 23)
Me.Button6.TabIndex = 10
Me.Button6.Text = "Get multiplication"
Me.Button6.UseVisualStyleBackColor = True
'
'Button7
'
Me.Button7.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button7.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button7.Location = New System.Drawing.Point(193, 180)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(127, 23)
Me.Button7.TabIndex = 11
Me.Button7.Text = "Total from X to Y"
Me.Button7.UseVisualStyleBackColor = True
'
'Button8
'
Me.Button8.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button8.ForeColor = System.Drawing.Color.DarkSlateBlue
Me.Button8.Location = New System.Drawing.Point(193, 209)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(127, 23)
Me.Button8.TabIndex = 12
Me.Button8.Text = "Show odd Number"
Me.Button8.UseVisualStyleBackColor = True
'
'Button9
'
Me.Button9.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button9.ForeColor = System.Drawing.Color.SeaGreen
Me.Button9.Location = New System.Drawing.Point(193, 238)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(125, 23)
Me.Button9.TabIndex = 13
Me.Button9.Text = "Show even Number"
Me.Button9.UseVisualStyleBackColor = True
'
'Button10
'
Me.Button10.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button10.ForeColor = System.Drawing.Color.Red
Me.Button10.Location = New System.Drawing.Point(193, 327)
Me.Button10.Name = "Button10"
Me.Button10.Size = New System.Drawing.Size(121, 42)
Me.Button10.TabIndex = 14
Me.Button10.Text = "Exit"
Me.Button10.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(338, 397)
Me.Controls.Add(Me.Button10)
Me.Controls.Add(Me.Button9)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Multiplication"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim X As Integer


X = CInt(TextBox1.Text)

X = X - 1
TextBox1.Text = X
End Sub




Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim X As Integer


X = CInt(TextBox1.Text)

X = X + 1
TextBox1.Text = X
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Y As Integer

Y = CInt(TextBox2.Text)
Y = Y - 1
TextBox2.Text = Y

End Sub


Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Y As Integer

Y = CInt(TextBox2.Text)
Y = Y + 1
TextBox2.Text = Y

End Sub




Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Me.Close()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim X As Integer
Dim Y As Integer
Dim multiplication As Integer


X = CInt(TextBox1.Text)
Y = CInt(TextBox2.Text)

For X = 1 To 12
multiplication = X * Y
ListBox1.Items.Add(X & "X" & Y & "=" & multiplication)

Next

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ListBox1.Items.Clear()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim X As Integer
Dim Y As Integer
Dim total As Integer


X = CInt(TextBox1.Text)
Y = CInt(TextBox2.Text)

For i = X To Y
total = total + i
Next
ListBox1.Items.Add(total)
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim num, X, Y As Integer


X = CInt(TextBox1.Text)
Y = CInt(TextBox2.Text)


For num = X To Y
If num Mod 2 <> 0 Then
ListBox1.Items.Add(num)
num = num + 1
End If

Next

End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim num, X, Y As Integer


X = CInt(TextBox1.Text)
Y = CInt(TextBox2.Text)


For num = X To Y
If num Mod 2 <> 1 Then
ListBox1.Items.Add(num)
num = num + 1
End If
Next

End Sub
End Class




it started from button 5 .which includes clear list, get multiplication, get odd and even number and get total from X and Y.

these all it said error of listbox undeclared. how can i declared it. please show me. thank you very much
Dec 6 '11 #3
jamesd0142
469 256MB
Im just getting back to coding after 2 years (less than 1 hour atm) so forgive me if this is wrong and im rusty.

drag a listbox onto your form.
Or add the code:

Expand|Select|Wrap|Line Numbers
  1.  Dim listbox1 As ListBox
  2.  
Dec 7 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Michael Ströder | last post by:
HI! I'm trying to build Python2.4 on a rather old Debian machine. I only have a shell account there. That's why I'm very limited in my actions. Building _socket fails (see below) although I...
2
by: Mike Schinkel | last post by:
I'm trying to set up a Windows 2003 server using ASP, and I am find ASP pages just STOP as if I had called Response.End whenever an undeclared variable is found. If I turn off Option Explicit, it...
17
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP)...
9
by: W. Van Hooste | last post by:
Just starting with C, can somebody explain why this does not work or point me in the right direction? I wrote some tools and did some coding but cant seem to get this one. I DID declare my FILE...
3
by: ECathell | last post by:
Below is the code for a custom form control. Everything is good except I am getting the above error. I have Highlighted the relevant code below. I can't find the problem..Can anyone help me? I am...
6
by: Peter Rothenbuecher | last post by:
Hello, when I try to compile the following code with g++ -o client client.c #include<sys/socket.h> #include<stdio.h> #include<stdlib.h> #define ADDRESS "mysocket"; #define MAXLEN 200;
7
by: michigaki | last post by:
hello, we are having problems in compiling a 'slightly' altered x264. We are always receiving a 'helloWorld' undeclared (first use this function) error. We may be commiting a very simple error but...
6
by: Alfred | last post by:
On Ubuntu, I've been experimenting with Kazuho Oku's fascinating Linux- based perl/C trick to implement C and C++ as a scripting language... ...
7
by: Adam01 | last post by:
Im using cygwin to test the code of a server I am writing. I've included sys/types.h, sys/socket.h, netdb.h, and arpa/inet.h. And this is the output.. ../../../sockets.cpp: In constructor...
0
by: tvnaidu | last post by:
Trying to compile sqlite3 (3.6.22), getting this error "`Tcl_WideInt' undeclared", I have tcl.h was included, but still getting any idea why?. libtool: link: gcc -g -O2 -DSQLITE_OS_UNIX=1 -I....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.