Adblock breaks this site

A few simple questions. :)

Discussion in 'Programming General' started by WoW Sucks, Nov 1, 2007.

  1. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    Thanks :)

    New questions added.
     
  2. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    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
     
  3. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    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.

    :)
     
  4. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    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.
     
  5. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    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.
     
  6. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    Thanks, i used Darthatron's one :)
     
  7. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    New question added.
     
  8. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    A few simple questions. :)

    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
    
     
  9. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    Oh wow, thanks alot. That helped me understand the uses of cases :)

    EDIT: New question added.
     
  10. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    A few simple questions. :)

    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
     
  11. bojanglesman

    bojanglesman Member

    Joined:
    Nov 4, 2007
    Posts:
    32
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    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"
     
  12. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

  13. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    Thanks Jazz, but it's abit too complicated for my level.

    New question added.
     
  14. bojanglesman

    bojanglesman Member

    Joined:
    Nov 4, 2007
    Posts:
    32
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    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?
     
  15. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    A few simple questions. :)

    Well if his dick fails then you just don't have one. In nice big print we have:
    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.
     
  16. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    A few simple questions. :)

    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.
     
  17. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    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?
     
  18. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    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....
     
  19. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    A few simple questions. :)

    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 :(
    Haha, WS is doing an assignment :p
     
  20. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    A few simple questions. :)

    This is slowly turning into "THE ULTIMATE VB6 NOOB GUIDE"... Somebody should add them all together and make a book, or something. =)
     
< echo in C | Need tutor on Programming >


 
 
Adblock breaks this site