Avatar of Member_2_5230414
Member_2_5230414

asked on 

Input string was not in a correct format.

Any idea why i get Input string was not in a correct format.

for

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        forumstats.Visible = False
        Dim s As String = Request.QueryString("fn")
        If s <> "News" Or "General" Or "Training&Races" Or "Injurys&Health" Or "Other" Then

            Submit.Visible = False
        End If
    End Sub

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
Member_2_5230414
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Probably because you want to insert the "&" in your queryString

Try to replace this

Are you looking for Server.URLEncode?
http://www.4guysfromrolla.com/webtech/042601-1.shtml

Or maybe Server.HTMLEncode and Server.HTMLDecode?
http://www.devx.com/tips/Tip/13459

Hi,
Following is not allowed at all
        If s <> "News" Or "General" Or "Training&Races" Or "Injurys&Health" Or "Other" Then  

You may use it as

        If s <> "News" Or s <> "General" Or s <> "Training&Races" Or s <> "Injurys&Health" Or s <> "Other" Then  

Thanks
Avatar of Member_2_5230414
Member_2_5230414

ASKER

IS IT THE FACT IM USING THE OR COMMAND?
Avatar of Member_2_5230414

ASKER

I tried your above suggestion IJZ but even if my link is http://localhost:2103/runningprofiles/forums/newthread.aspx?fn=News the button does not get displayed
You are using your <> logic incorrectly
Please use it as following:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        forumstats.Visible = False
        Dim s As String = Request.QueryString("fn")
        If s = "News" Or s = "General" Or s = "Training&Races" Or s = "Injurys&Health" Or s = "Other" Then

            Submit.Visible = False
        End If
    End Sub
Avatar of Member_2_5230414

ASKER

Just to help here is my code:

<asp:Button ID="Submit" runat="server" Text="Button"  />

and

Imports Microsoft.VisualBasic
Imports BBcode

Partial Class forums_newthread
    Inherits System.Web.UI.Page


    Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click
        Dim s As String = Request.QueryString("fn")
   
        If s <> "News" Or s <> "General" Or s <> "Training&Races" Or s <> "Injurys&Health" Or s <> "Other" Then

            newthread.addpost(s, theTitle.Text, inputforum.Text)
        End If

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        forumstats.Visible = False
        Dim s As String = Request.QueryString("fn")
        If s <> "News" Or s <> "General" Or s <> "Training&Races" Or s <> "Injurys&Health" Or s <> "Other" Then

            Submit.Visible = False
        End If
    End Sub
End Class

Open in new window

Avatar of Member_2_5230414

ASKER

IJZ: i want to do the code if they are not these

so if s is not the 5 names the button.visable = false
do you want if fn=News, or General or then but should be visible or not visible
ASKER CERTIFIED SOLUTION
Avatar of Imran Javed Zia
Imran Javed Zia
Flag of Pakistan image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Member_2_5230414

ASKER

Needed an else statement then :)
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo