Question Manipulate Web Form in Windows App

JustinCredible

New member
Joined
Aug 23, 2009
Messages
3
Programming Experience
Beginner
I want to create a program which inserts the person's data from a textbox into a form on the webpage named "name" (for example).

I want to be able to make them select from a dropdown list named "cat" and what they select is selected on the dropdown form too.

I also want them to be able for the person to select a file on their machine which is entered in a form named "thumb"

I'm completely stumped on how to do the above in VB 08. Also, how to use a submit button? On the page, the submit button's code is
<input type='submit' value='Submit' />
How to manipulate that in VB 08?

Excuse me if this was asked, Google wasn't in my favours today.
 
Hello.

As always, may I suggest to have a look at the method the webpage is using to submit the query and try to directly call this method, instead of trying to fill the webform?

F.e.:
A webpage has one textbox and the submit button...the underlying code is most likely looking like this:
VB.NET:
<form action="submit.php" method="get">
      <input type="text" name="testbox">
      <input type="submit" value="Submit">
</form>
Means, if you press submit, it will call the following url:
VB.NET:
http://www.whatever.com/submit.php?testbox=inputValue
Calling that address might be easier to figure out, at least in my opinion.

Best Regards,
Bobby
 
Please provide meaningful thread titles. Something that describes the topic should be provided as whether or not a question is quick isn't really relevant.

Excuse me, I am sorry. I should have known better but it was early in the morning and coffee cup was empty. :p Although, that is no proper excuse, so we'll just say I'm an idiot.

Thank you for the help Robert. I tried what you said and used the code below

VB.NET:
If gamesname.Text = "1" Or "2" Then
            errortext.Text = "Error detected: Unallowed game"
        Else
            System.Diagnostics.Process.Start("http://www.websiteinquestion.com/submit/form.html?name= " & gamesname & "desc=" & desc & "instructions=" _
& description & "cat=" & ListBox1.SelectedItem & "swf=" & OpenFileDialog1.FileName & "thumb=" & OpenFileDialog2.FileName & "authorname=" & username & "authorsite=" & website & "")
        End If

And I manage to get a wonderful blue line that I don't know how to get rid of. The error is
Operator '&' is not defined for types 'String' and 'System.Windows.Forms.TextBox'.
Any available help? I'm somewhat new to VB but I thought this would be easy... lol.
 
Hello.

Turn Option Strict On in the Settings! You've got a simple typecasting error there...

VB.NET:
        If gamesname.Text = "1" Or [B]gamesname.Text =[/B] "2" Then
            errortext.Text = "Error detected: Unallowed game"
        Else
            System.Diagnostics.Process.Start("http://www.websiteinquestion.com/submit/form.html?name= " & gamesname[B].Text[/B] & _
            "[B]&[/B]desc=" & desc & _
            "&instructions=" & description & _
            "&cat=" & ListBox1.SelectedItem.ToString() & _
            "&swf=" & OpenFileDialog1.FileName & _
            "&thumb=" & OpenFileDialog2.FileName & _
            "&authorname=" & username & _
            "&authorsite=" & website)
        End If

Every thing in .NET is an Object which has Properties and Methods...so does the Textbox. Of course, a Textbox is a control which can't be so easily concatenated into a String. ;)

Also, you may have to encode some of these parameters...have a look at there: Percent-encoding - Wikipedia, the free encyclopedia

Best Regards,
Bobby
 
Last edited:
After realizing that it'd have to do something which is WAY to complex I decided to abort the project. Although it's not a complete failiure, because now I know alot more. Thanks Bobby for all of the help
 
Back
Top