Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
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 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 April 4th, 2005, 06:08 AM
Authorized User
 
Join Date: Apr 2005
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

 
Old April 4th, 2005, 10:49 AM
Friend of Wrox
 
Join Date: Nov 2004
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.)
 
Old April 4th, 2005, 11:03 AM
Authorized User
 
Join Date: Apr 2005
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





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





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