Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 24th, 2007, 02:40 PM
santo9424 santo9424 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 8 santo9424 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 4 h 25 m 44 sec
Reputation Power: 0
Unhappy Coding variable varray

Code:
Option Explicit

Dim strcapitals(1 To 50) As String

Private Sub cmdExit_Click()
    Unload frmStates
End Sub

Private Sub cmdPrint_Click()
    PrintForm
End Sub


Private Sub Form_Load()
    frmStates.Left = (Screen.Width - frmStates.Width) / 2
    frmStates.Top = (Screen.Height - frmStates.Height) / 2
lstState.AddItem "Alabama"
lstState.AddItem "Alaska"
lstState.AddItem "Arizona"
lstState.AddItem "Arkansas"
lstState.AddItem "California"
lstState.AddItem "Colorado"
lstState.AddItem "Connecticut"
lstState.AddItem "Delaware"
lstState.AddItem "Florida"
lstState.AddItem "Georgia"
lstState.AddItem "Hawaii"
lstState.AddItem "Idaho"
lstState.AddItem "Illinois"
lstState.AddItem "Indiana"
lstState.AddItem "Iowa"
lstState.AddItem "Kansas"
lstState.AddItem "Kentucky"
lstState.AddItem "Louisiana"
lstState.AddItem "Main"
lstState.AddItem "Massachusetts"
lstState.AddItem "Michigan"
lstState.AddItem "Minnesota"
lstState.AddItem "Mississippi"
lstState.AddItem "Missouri"
lstState.AddItem "Montana"
lstState.AddItem "Nebraska"
lstState.AddItem "Nevada"
lstState.AddItem "New Hampshire"
lstState.AddItem "New Jersey"
lstState.AddItem "New Mexico"
lstState.AddItem "New York"
lstState.AddItem "North Carolina"
lstState.AddItem "North Dakota"
lstState.AddItem "Ohio"
lstState.AddItem "Oklahoma"
lstState.AddItem "Oregon"
lstState.AddItem "Pennsylvania"
lstState.AddItem "Rhode Island"
lstState.AddItem "South Carolina"
lstState.AddItem "South Dakota"
lstState.AddItem "Tennessee"
lstState.AddItem "Texas"
lstState.AddItem "Utah"
lstState.AddItem "Vermont"
lstState.AddItem "Virginia"
lstState.AddItem "Washington"
lstState.AddItem "West Virginia"
lstState.AddItem "Wisconsin"
lstState.AddItem "Wyoming"
lstState.ListIndex = 0
strcapitals(1) = "Montgomery"
strcapitals(2) = "Juneau"
strcapitals(3) = "Phoenix"
strcapitals(4) = "Little Rock"
strcapitals(5) = "Sacramento"
strcapitals(6) = "Denver"
strcapitals(7) = "Hartford"
strcapitals(8) = "Dover"
strcapitals(9) = "Tallahassee"
strcapitals(10) = "Atlanta"
strcapitals(11) = "Honolulu"
strcapitals(12) = "Boise"
strcapitals(13) = "Springfield"
strcapitals(14) = "Indianapolis"
strcapitals(15) = "Des Moines"
strcapitals(16) = "Topeka"
strcapitals(17) = "Frankfort"
strcapitals(18) = "Baton Rouge"
strcapitals(19) = "Augusta"
strcapitals(20) = "Annapolis"
strcapitals(21) = "Boston"
strcapitals(22) = "Lansing"
strcapitals(23) = "St. Paul"
strcapitals(24) = "Jackson"
strcapitals(25) = "Jefferson City"
strcapitals(26) = "Helena"
strcapitals(27) = "Lincoln"
strcapitals(28) = "Carson City"
strcapitals(29) = "Concord"
strcapitals(30) = "Trenton"
strcapitals(31) = "Santa Fe"
strcapitals(32) = "Albany"
strcapitals(33) = "Raleigh"
strcapitals(34) = "Bismarck"
strcapitals(35) = "Columbus"
strcapitals(36) = "Oklahoma City"
strcapitals(37) = "Salem"
strcapitals(38) = "Harrisburg"
strcapitals(39) = "Providence"
strcapitals(40) = "Columbia"
strcapitals(41) = "Pierre"
strcapitals(42) = "Nashville"
strcapitals(43) = "Austin"
strcapitals(44) = "Salt Lake City"
strcapitals(45) = "Montpelier"
strcapitals(46) = "Richmond"
strcapitals(47) = "Olympia"
strcapitals(48) = "Charleston"
strcapitals(49) = "Madison"
strcapitals(50) = "Cheyenne"

End Sub


Private Sub lstState_Click()
Dim intx As Integer
For intx = 1 To 50
If lstState.ListIndex = strcapitals Then
 lblCapital.Caption = strcapitals(intx)
    End If
    Next intx
End Sub


i have a problem coding the variable array in the lststate _click i would like your help thank you.

Last edited by Shadow Wizard : July 25th, 2007 at 06:47 AM. Reason: added [Code] and [/Code] tags please do that yourself next.

Reply With Quote
  #2  
Old July 25th, 2007, 06:49 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
please use code tags.
your whole logic is just wrong.
change this block of code:
Code:
For intx = 1 To 50
If lstState.ListIndex = strcapitals Then
 lblCapital.Caption = strcapitals(intx)
    End If
    Next intx

to this line:
Code:
lblCapital.Caption = strcapitals(lstState.ListIndex)

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Coding variable varray


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT