Results 1 to 2 of 2

Thread: HTTP, HTTPS, UNC - textbox prefix

  1. #1

    Thread Starter
    Hyperactive Member gmatteson's Avatar
    Join Date
    Feb 2002
    Location
    Rhode Island, USA
    Posts
    293

    HTTP, HTTPS, UNC - textbox prefix

    Hi,
    I have a textbox that I want to found out if the data entered into it starts off with certain text i.e.

    if the user typed in "http://myserver/sharedname" as the path for the file, i want to be able to tell if it's a web addres...

    the way i'm trying to do it to cut down on code rather than parsing through the string is to...


    Select Case txtNetPath.Text.ToString
    Case strPrefix.StartsWith("http://") = true
    MsgBox("http://")
    Case strPrefix.StartsWith("https://") = true
    MsgBox("https://")
    End Select

    this select case doesn't work, yet an if then does.... I rather use the select case since it is easier to look at and faster? thanks.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim strHtml As String = TextBox1.Text
    3.         If Not Len(strHtml) < 7 Then
    4.             Select Case strHtml.Substring(0, 7)
    5.                 Case "http://"
    6.                     MessageBox.Show("i'm a [url]http://[/url] link !")
    7.                 Case "https:/"
    8.                     MessageBox.Show("i'm a [url]https://[/url] link !")
    9.             End Select
    10.         End If
    11.     End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width