There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
bios black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers email error excel explorer firefox firefox 3 hard drive internet internet explorer itunes laptop linux malware monitor network networking outlook outlook 2003 outlook express password printer problem problems ram router security slow software sound startup trojan usb virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Visual Basic Express 2005: Variables = Arrrrrrrgggggg!!! - HELP PLZ


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
mattvot's Avatar
Member with 40 posts.
 
Join Date: Apr 2007
Experience: Intermediate
28-Sep-2007, 05:05 AM #1
Exclamation Visual Basic Express 2005: Variables = Arrrrrrrgggggg!!! - HELP PLZ
I have a webbrowser programme and im using variables to set the home page.

Currently here's my code.

----------------------------------------------------
This is the intenet option form where i want to be able to set a home page just for this browser.
----------------------------------------------------

Code:
Public Class InternetOptons

    Public homepage123 As String
    Private Sub OKButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton1.Click

        homepage123 = HomepageSetTextBox1.Text

        Me.Close()
    End Sub

    Private Sub CloseForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseForm.Click
        Me.Close()
    End Sub
End Class
--------------------------------------------------
Heres an example on how i use the variable 'homepage123'
--------------------------------------------------

Code:
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate(InternetOptons.homepage123)
    End Sub
Now i dont know why but it doesnt workWHERE AM I GOING WRONG?
artur02's Avatar
Computer Specs
Member with 91 posts.
 
Join Date: Sep 2007
Location: Hungary
Experience: Advanced
28-Sep-2007, 12:03 PM #2
Try something like this:

Code:
Public Class Form1

    Public homepage123 As String
    Private Sub OKButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton1.Click

        homepage123 = HomepageSetTextBox1.Text
        WebBrowser1.Navigate(homepage123)

        'Me.Close()
    End Sub

    Private Sub CloseForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseForm.Click
        Me.Close()
    End Sub

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate(homepage123)
    End Sub

End Class
In your code when you call the
Code:
WebBrowser1.Navigate(InternetOptons.homepage123)
line, the
Code:
homepage123
variable MUST be initialized to a value or you must assign a value before using that variable.
mattvot's Avatar
Member with 40 posts.
 
Join Date: Apr 2007
Experience: Intermediate
28-Sep-2007, 01:22 PM #3
Thanks, it works now
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:58 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.