• Log in or sign up for an account here: https://www.sythe.org/login

A few simple questions. :)

Thanks :)

New questions added.
 
Ok

Question 8:

Just add an "Internet Transfer Control" and the code
Code:
Text1.text=inet1.openurl("http://google.com")

Question 9:
Very basic and easy to remember

Code:
Dim ff As Integer
    ff = FreeFile 'Sets FF=to the next open free file
        Open App.Path & "\someFile.txt" For Output As #ff 'Creates a new file
            Print #ff, Text1.Text 'Populates the text file with the text from Text1
        Close #ff 'Closes the text file
 
Thanks for the help with question 9, but i don't understand what you mean with question 8.

I want to be able to click a button and then have it download the source code of the website that is in text1.text.

:)
 
Ok, you need a new component, Microsoft Internet Transfer Control (I think).

Next add the Inet Control (The one you just added) anywhere on the form.

In the Command1_Click() Sub put this...
Code:
Text1.Text = Inet1.OpenURL ("http://www.sythe.org")

Replace "http://www.sythe.org" with what ever website you like.

PS. You can't use WebBrowser for this, Microsoft likes to make life hard.
 
Actually if you have a Internet Control on your form you can use

Code:
Text1.Text = Form1.WebBrowser1.Document.documentElement.innerHTML

But use the above code if you don't have a web browser control.
 
Thanks, i used Darthatron's one :)
 
New question added.
 
Question 10:

How would i make it so, when i put some text in a textbox and click a button, it outputs a chosen word/number (from the first textbox) into another textbox.
Assuming you have the controls Text1 and Text2 (TextBoxes), and a button called Command1.

This would output whatever is in your first textbox to your second one.
Code:
Private Sub Command1_Click()
Text2.Text = Text1.Text
End Sub

Using If statements or Select Case you can have it output something in your second textbox based on what was put into the first one. I've chosen Select Case because it makes for shorter simpler code and I figured you might learn more from it than from normal If statements.
Code:
Private Sub Command1_Click()
Select Case LCase(Text1.Text) 'Looking at a lowercase string of what is in your first textbox
Case "jagex"
Text2.Text = "Fags..."
Case "nullware"
Text2.Text = "Pretty Cool."
Case "wow sucks"
Text2.Text = "He's learning fast :)"
Case Else
Text2.Text = "That is not a person!!"
End Select
End Sub
 
Oh wow, thanks alot. That helped me understand the uses of cases :)

EDIT: New question added.
 
well get the url for the highscores (get the lite highscores url its faster and easier to parse). then you just do something like this.
Code:
dim strdata as string
strdata = inet1.openurl("theurlhere" & textbox1.text)

Assuming you have someones username in textbox1 it will put the data into the variable named strdata.
I'm sure this won't help very much butim going to bed now (4:24am, no life :p )
But if someone else hasn't helped ya do it by tomorrow night ill give ya a hand.
gnight
 
Question 3.

Answer

Code:
If Pic1.Visible = True Then
        MsgBox "It's Already Visible"
End If
else
MsgBox "It's Not Visible"

That will tell you if pic1 is visible or not just remove this part if you dont want it to say its not visible. I think this is what you wanted is it not?

Code:
else
MsgBox "It's Not Visible"
 
Thanks Jazz, but it's abit too complicated for my level.

New question added.
 
Your mom and her dick fails... All i did was answer his question he didn't say that if it was already answered, don't answer it again did he?
Well if his dick fails then you just don't have one. In nice big print we have:
Green = Need answering
Red = Answered.

Question 3:

How would i make it so, when a picturebox is set to visible already, and i click the 'make visible' button, i get a message box saying that it's already set to visible?

In regards to Question 12 I think what you want is this.
Code:
 If picture1.picture = "images\0.jpg" then
        msgbox "The picture is visible"
 End if

For Question 13 I would say just put it in a timer and enable that timer whenever the game is started. If for some reason that can't work for you just post so in the thread and I'll try to think of something else.
 
Question 13:

What do i do to make a peice of code that gets looked at ever few seconds?

for example, im playing tic tac toe, and when i get 3 'X' in a row, it gives me a messagebox saying ive won. How would i make the program keep looking back to that section of code to see if i had won or not.

For this you would have to continously check in a loop or anything, you would just make a function to check if there were 3 in a row, and after each person had there turn you would call the function.
 
Thanks for the help again guys, but i don't think Nullware's code works for Q12. It gives me a error.

So any other ideas?
 
Question 14:

Sub => Subroutine

A section of code which can be called to perform a certain action. Does not return anything.

Code:
Sub SubTest1 ()

End Sub
Code:
Sub SubTest2 (Input1 as [I]VARIABLE[/I])

End Sub
Function
Basically the same as a subroutine, but should be used to return a variable.


Code:
Function FunctionTest1 () as [I]VARIABLE[/I]

End Function
Code:
Function FunctionTest2 (Input1 as [I]VARIABLE[/I]) as [I]VARIABLE[/I]

End Function
Subs should be called thusly:

Code:
Call SubTest1
Code:
Call SubTest2("String")
Call SubTest2(1) 'Integer
Call SubTest2(Array())
Functions should be used similar to this:

Code:
Output = FunctionTest1
Code:
Output = FunctionTest1("String")
Output = FunctionTest1(1)
Output = FunctionTest1(Array())
Question 12:

Code:
If Picture1.Picture = 0 Then MsgBox "No pic loaded" 
'or
If Picture1.Picture <> 0 Then MsgBox "Pic loaded" 
'or using NOT
If Not Picture1.Picture = 0 Then MsgBox "Pic loaded"
On a side note; Why do you ask for complicated things (or things you can't do) and not use them?
Also, what is this for? I somehow see us building a project for you, or doing some schoolwork for you....
 
For question 13.
You will just have to make a variable of something, and when you load a picture (pretend the picture is of a dog). Make the variable equal "dog". then just check if that variable is "dog" and if it is then you know the dog picture is loaded.
Example:
Code:
dim lol as string

private sub command1_click()
  image1.picture = loadpicture(app.path & "\dog.jpg")
  lol = "dog"
end sub

Question 14.
The difference between a sub and a function is that a function is used to return a value, where as a sub just does stuff :p. There could be more to do this, but that is all i think it does.
Example.
Code:
private sub DisplayMsgBox(strMsg as string)
  msgbox strmsg
end sub

To use that you would just do:
Code:
displaymsgbox "hello"
It would display a message box saying "hello".

Now for a function.
Code:
private function IsFormVisible(frmForm as form) as boolean
  isformvisible = false
  if frmform.visible = true then
    isformvisible = true
  end if
end function

To use that you would do something like.
Code:
if isformvisible(form1) = true then
  msgbox "form1 is visible"
end if

EDIT:
Damn it jazz, i typed all that for nothing :(
On a side note; Why do you ask for complicated things (or things you can't do) and not use them?
Also, what is this for? I somehow see us building a project for you, or doing some schoolwork for you....

Haha, WS is doing an assignment :p
 
This is slowly turning into "THE ULTIMATE VB6 NOOB GUIDE"... Somebody should add them all together and make a book, or something. =)
 
Runescape Gamblingrunescape gambling
Back
Top