Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2005, 06:08 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Input string was not in a correct format

hey,
i've tried everything i know to change the following code into a format that i thought would be accepted by vb.net,
but i'm not having any success.
Can anyone please help me!!!

Code

Sub CheckMain(sender As Object, e As EventArgs)
        if sys.SelectedItem.Value is "6024H-I" or "6014H-T" or "6014P-82R" or "7044H-T" then
        dualxeon.visible = True
        elseif sys.SelectedItem.Value is "6013P-T" or "6023P-I" then
        xeon.visible = True
        elseif sys.SelectedItem.Value is "5013C-T" then
        p4.visible = True
        elseif sys.SelectedItem.Value is "6113L-8" then
        itanium.visible = True
        else
        MsgBox("Please choose a Server to continue")
        end if
    End Sub

END CODE

All help would be really appreciated

Reply With Quote
  #2 (permalink)  
Old April 4th, 2005, 10:49 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If you put [ code] at the beginning of a block of code (remove the space) and [ /code] (remove the space) after a block of code when you make a post here, a new line will be generated before and after, and the text in between will be fixed proportion.

Try
Code:
Sub CheckMain(sender As Object, e As EventArgs)

    if sys.SelectedItem.Value = "6024H-I" Or sys.SelectedItem.Value = "6014H-T" Or _
       sys.SelectedItem.Value = "6014P-82R" Or sys.SelectedItem.Value = "7044H-T" Then
        dualxeon.visible = True
    ElseIf sys.SelectedItem.Value = "6013P-T" Or sys.SelectedItem.Value = "6023P-I" Then
        xeon.visible = True
    ElseIf sys.SelectedItem.Value = "5013C-T" Then
        p4.visible = True
    ElseIf sys.SelectedItem.Value = "6113L-8" then
        itanium.visible = True
    Else
        MsgBox("Please choose a Server to continue")
    End If

End Sub
For readability, you could use
Code:
Sub CheckMain(sender As Object, e As EventArgs)

    Select Case sys.SelectedItem.Value
        Case "6024H-I", "6014H-T", "6014P-82R", "7044H-T"
            dualxeon.visible = True

        Case "6013P-T", "6023P-I"
            xeon.visible = True

        Case "5013C-T"
            p4.visible = True

        Case "6113L-8"
            itanium.visible = True

        Case Else
            MsgBox("Please choose a Server to continue")

    End Select

End Sub
Also (if I were you) I would use the shift key a little more.
“i've tried everything i know...” (compared to “I've tried everything I know...”) looks like a post by a 14 year old girl using instant messaging . . . (Just a thought.)
Reply With Quote
  #3 (permalink)  
Old April 4th, 2005, 11:03 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply Brian,
plus I'll use the shift key a little bit more
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Input string was not in a correct format Dwizz VB.NET 2002/2003 Basics 8 April 29th, 2010 05:56 AM
Input string was not in a correct format. Silfverduk VB.NET 2002/2003 Basics 1 May 20th, 2006 04:58 AM
input string was not in a correct format kunal.net VS.NET 2002/2003 1 October 11th, 2005 12:18 AM
"Input string was not in a correct format." keane Pro VB.NET 2002/2003 1 December 18th, 2004 08:45 PM



All times are GMT -4. The time now is 04:37 AM.


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