For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Im completing a project for my VB class and kind of lost at some things.. these are the requirements:
Julia really liked the How Big is My Room app but realized it would be much
better if she could calculate the cost of ALL of her rooms in the same window. She would keep a
similar layout, but change the program to handle a list of rooms, displaying the size and cost of all
of the rooms and a total cost to resurface the floors in her entire home.
She knows that if she measures the length and width of each room, she can determine the area or
square-footage. (roomSize = roomWidth * roomLength)
To get the price for each room she multiplies the area of the room times the price of the material
(totalCost = roomSize * costOfMaterial)
Presents the user with a picture of carpet or other flooring material (you will need to find an
images on the World Wide Web and download it. Must be in JPG,PNG,GIF,TIF format)
b. Present the user the option to enter her first name
c. Present the user the option to enter her last name
d. Present the user the option to enter the room name
e. Present the user the option to enter the room width (in feet)
f. Present the user the option to enter the room length (in feet)
1) The picture must change to the corresponding floor type
2) The cost of material must change
3) The cost per room for each room must change and be displayed properly
4) The output totals should reflect the change
i. When a user changes a floor type…
Present the user the option to choose a floor type using radio buttons. The text of the radio
button should reflect the type and cost per sq/ft for that type.
Present a list of rooms in a list box. Each room in the list box will be indicated by its room
i. Use other listboxes to keep track of the length, width and total cost of a room.
Presents the user the option to submit the entry with a button by clicking with the mouse or
pressing the enter key.
j.Check to make sure all boxes are filled in. Warn the user with a message box that
states "Please enter something in all boxes" (or a similar message) -- (hint: if
textbox1.text <> "" and textbox2.text <> "" then…)
Check to make sure the user has chosen a floor type. Warn the user with a message
that states "Please choose a Floor Type first!" (or a similar message) -- (hint: if
radio1.checked = true then…)
iii. Enter the room information to the appropriate list boxes
a) First Name "Julia"
b) Last Name "Anderson"
1) If the user provides the following input
iv. Output as indicated below…
k. When the user clicks the button…
4. Create a Visual Basic 2012 Program for Julia that does the following
i) "Hello Julia, the Anderson home estimate:"
ii) "Total number of Rooms: 00"
iii) "Total Square Footage: 0.0 sq/ft"
iv) "Total cost to resurface: $0.00"
a) The output should be displayed as follows
i. Wood Floors: $5.00 sq/ft
a. When the form loads, you will need to set the cost of the material and radio buttons text
Programming Assignment #3 - How Big are My Rooms?
i. Wood Floors: $5.00 sq/ft
ii. Carpet: $3.00 sq/ft
iii. "Carpet: $3.00 sq/ft"
iv. "Wood: $5.00 sq/ft"
• The program requires the Option Strict compiler directive
and my code I have so far is :
Option Strict OnPublicClass fmResurface
PublicConst dblWoodFlooring AsDouble = 5D
PublicConst dblCarpetFlooring AsDouble = 3D ' This class variable doesnt change and is available througout app'
Dim dbldefaultWoodcost AsDoubleDim dbldefaultcarpetcost AsDoublePrivateSub Label1_Click(sender AsObject, e As EventArgs) Handles lblOutput.Click
EndSubPrivateSub Label1_Click_1(sender AsObject, e As EventArgs) Handles lblOutputNumberRooms.Click
EndSubPrivateSub GroupBox1_Enter(sender AsObject, e As EventArgs) Handles GBFloorType.Enter
EndSubPrivateSub Form1_Load(sender AsObject, e As EventArgs) HandlesMyBase.Load
dbldefaultcarpetcost = dblCarpetFlooring
dbldefaultWoodcost = dblWoodFlooring
EndSubPrivateSub Label1_Click_2(sender AsObject, e As EventArgs) Handles Label1.Click
EndSubPrivateSub btnEnter_Click(sender AsObject, e As EventArgs) Handles btnEnter.Click
Dim strFirstName AsStringDim strLastName AsStringDim strRoomName AsStringDim strRoomWidth AsStringDim strRoomLength AsStringDim dbltotalcost AsDouble
strFirstName = txtFirstName.Text
strLastName = txtLastName.Text
strRoomName = txtRoomName.Text
strRoomLength = txtRoomLength.Text
strRoomWidth = txtRoomWidth.Text
If strFirstName <> ""And strLastName <> ""And strRoomLength <> ""And strRoomName <> ""And strRoomWidth <> ""Then
MessageBox.Show("Enter data into boxes!")
dbltotalcost = Val(txtRoomLength.Text) * Val(txtRoomWidth.Text)
If RBWoodFloor.Checked = FalseAnd RBCarpet.Checked = FalseThen MessageBox.Show("Choose a floor type!")
If RBWoodFloor.Checked = TrueThen dbldefaultWoodcost = dblWoodFlooring
If dbldefaultWoodcost = dblWoodFlooring ThenCall lbRoomName.Items.Add(txtRoomName.Text)
If dbldefaultWoodcost = dblWoodFlooring ThenCall lbRoomLength.Items.Add(txtRoomLength.Text)
If dbldefaultWoodcost = dblWoodFlooring ThenCall lbRoomWidth.Items.Add(txtRoomWidth.Text)
If dbldefaultWoodcost = dblWoodFlooring ThenCall lbTotalCost.Items.Add(dbltotalcost * dblWoodFlooring)
ElseIf dbldefaultcarpetcost = dblCarpetFlooring ThenCall lbTotalCost.Items.Add(dbltotalcost * dblCarpetFlooring)
If RBCarpet.Checked = TrueThen dbldefaultcarpetcost = dblCarpetFlooring
If dbldefaultcarpetcost = dblCarpetFlooring ThenCall lbRoomName.Items.Add(txtRoomName.Text)
If dbldefaultcarpetcost = dblCarpetFlooring ThenCall lbRoomLength.Items.Add(txtRoomLength.Text)
If dbldefaultcarpetcost = dblCarpetFlooring ThenCall lbRoomWidth.Items.Add(txtRoomWidth.Text)
EndEndSubPrivateSub lbTotalCost_SelectedIndexChanged(sender AsObject, e As EventArgs) Handles lbTotalCost.SelectedIndexChanged
EndSubPrivateSub RBWoodFloor_CheckedChanged(sender AsObject, e As EventArgs) Handles RBWoodFloor.CheckedChanged
If RBWoodFloor.Checked Then pccarpet.Image = My.Resources.floor
EndSubPrivateSub RBCarpet_CheckedChanged(sender AsObject, e As EventArgs) Handles RBCarpet.CheckedChanged
If RBCarpet.Checked Then pccarpet.Image = My.Resources.nice
EndSubPrivateSub pccarpet_Click(sender AsObject, e As EventArgs) Handles pccarpet.Click
EndSubPrivateSub lbRoomName_SelectedIndexChanged(sender AsObject, e As EventArgs) Handles lbRoomName.SelectedIndexChanged
EndSubPrivateSub txtFirstName_TextChanged(sender AsObject, e As EventArgs) Handles txtFirstName.TextChanged
This is my first web page automation project, and I don't understand a couple of things.
So I have a form with a WebBrowser Object on it, I load the form, navigate to the web page, the web page loads ...
So the DocumentCompleted event fires?
I noticed it fires for every document requested, so I isolated the page I wanted
The page loads fine first.
Then I fire my automation script, which fixes the errors on the page, fills in the textboxes
I can see the page with my values, for about a millisecond.
[The part I don't' understand]
Then the page loads again, this time with scripts errors for everything, jquery and so forth, and the CSS is blown out.
Am I wasting my time with these event handlers,
When I write back to the WebBrowser1.DocumentText, am I forcing the page to load again?
Private Sub frm_download_Data_Load(sender As Object, e As EventArgs) Handles Me.Load
'Suppress the Script Errors
'Navigate the the Reseller Login Page
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) _
If Not (WebBrowser1.Url.AbsoluteUri = "about:blank") Then
If (e.Url.AbsolutePath = WebBrowser1.Url.AbsolutePath) Then
Select Case WebBrowser1.Url.AbsoluteUri
Case "http://page.asp"//Run the Automation
AddHandler CType(sender, WebBrowser).Document.Window.Error, AddressOf Window_Error
http_automation_login.automate(WebBrowser1, g_userName, g_password)
RemoveHandler CType(sender, WebBrowser).Document.Window.Error, AddressOf Window_Error
When you set this property, the WebBrowser control automatically navigates to the about:blank URL before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events occur when you set this property, and the value of the Url property is no longer meaningful.
If you're reading the DocumentText, changing it, and then writing it back to the WebBrowser, the resulting document won't have the same base URL, so it won't be able to resolve any scripts, stylesheets or images which use relative paths.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer