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. :)

    Here's My source ^_^ Im a mod :p
     
  2. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

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

    I'm shuddering at your code. I have it fixed, and reduced a bit. Nothing "Advanced" in there that you shouldn't know by now. (It's all in this thread)
     
  3. xenonium

    xenonium Guest

    Referrals:
    0
    A few simple questions. :)

    Answer 17:
    Better have a reset function,but not restarting the program.
    Make a subroutine that clears everything.
    or
    Make a procedure that clears the whole game.
     
  4. 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. :)

    Question 17.
    You could do what the above guy said.
    or
    you can just restart the program:
    Code:
    shell app.path & "\" & app.name & ".exe"
    end
     
  5. halojunkie

    halojunkie Active Member

    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0
    A few simple questions. :)

    When no one wins (cats game) it says someone won...

    Yea, Covey hats exactly what i thought he would do
     
  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 for that jazz, i could understand most of it, the things i didn't understand ive added to another question on the first post.

    The thing is, i wouldn't think to do any of it like that...as my code shows. I think i just need to learn abit more before i attepmt to make my code as efficient/small as that haha.
     
  7. 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. :)

    To answer your things in Question 18.
    1). A tag is just a property of a control (explained in 4.). you can store data in that "tag" for later use. You can kinda think of it as a variable.
    2). Never seen "MsgAns" used before, i have no idea what it is.
    3). "Me" refers to the current form. so if you did "msgbox me.name" on a form load event of a form it would display a message box with the form's name in it.
    4). a control is a command button, option button, listbox etc.
     
  8. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

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

    Ya, my "MsgAns" was undeclared, it should be the same as your "Dim a as VbMessageboxResult"

    You should declare it ASAP. Silly of me to forget it, but I'm (unfortunately) only human
     
  9. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

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

    I know they've been answered, but in one easy to read post.

    Question 18:

    1: What is a 'Tag' - Tag is just a property to store extra info about a control for further use.
    2: Is MsgAns just the same as using 'Dim a as VbMessageboxResult'? - Yes
    3: What does 'Me' mean/do? - Me refers to the current form (the form in which it is used, just quicker than typing FormName.Blah.Blah="Blah")
    4: What is a control? - A control is anything you add to your form, or in other words anything in your toolbox.
     
  10. WoW Sucks

    WoW Sucks Global Moderator
    Banned

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

    Thanks alot once again, im going to be quite busy these next few days so i may not post any more questions.

    :)

    <3
     
  11. 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 :)
     
  12. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

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

    Question 19:

    That is extremely easy, assuming you already know how to load a text file into a variable, this is how you do it. Make sure that the textfile has multiple lines (one line for each item in the combo box), then use this code

    Code:
    Dim Lines() as String 'Dims as array
    
    Lines=Split(Data, VBNewLine) 'This splits the data into sections by line
    For i=0 to Ubound(Lines) 'Loops through the data
    Combo1.Additem Lines(i) 'Add to a combo box.
    Next
    
    Question 20:
    The easiest way to use chameleon buttons is to right click your project explorer, and add user control, search for the place you added the chameleon buttons, then select the file. Once selected it will appear in the toolbox. You can manipulate the styles, by altering the ButtonStyle property, I believe. Besides that it is used pretty much the same way as a command button
     
  13. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

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

    Tidy up your code JD V_V.

    Code:
    Private Sub ReadFileIntoCombo(File_Path As String, Cmbo As combobox)
    Dim lonFF     As Long
    Dim tempstr() As String
    Dim i         As Integer
    
          lonFF = FreeFile
          Open File_Path For Binary Access Read As #lonFF
                tempstr = Split(Input(LOF(1), #lonFF), vbCrLf)
                For i = 0 To UBound(tempstr())
                      Cmbo.AddItem tempstr(i)
                Next i
          Close #lonFF
    End Sub
    
    Code:
    Call ReadFileIntoCombo("C:\ScanSectorLog.dat", Combo1)

    And the newer chameleon buttons needs a bit more done to it before you can use it.

    1. Goto your cham button folder
    2. Locate the folder tlb_source
    3. Open it
    4. Locate file MakeLib_sample.bat
    5. Edit it with notepad
    6. Remove the exit line
    7. Save and run
    8. In your VB project, select Projects > References
    9. Locate the file chameleon_dev.tlb in your C:\windows\system32\
    10. Press OK
    11. Load CTL file into project
    12. ???
    13. Proffit
    And you're done.
     
  14. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

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

    sorry Jazz, free handed it on here. I didn't even test.
     
  15. WoW Sucks

    WoW Sucks Global Moderator
    Banned

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

    Thanks alot :)

    New questions added.
     
  16. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

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

    Question 21:

    1: Open means open File, file_path is self explanitory, Binary Access simply means it reads it like binary (i think). And the lonFF is simply the file number, it opens a piece of open memory.
    2: Simply means, right click on project explorer, click add user control, then add the file you want.

    Question 22:

    Code:
    Private Sub Combo1_Click()
        Select Case Combo1.Text
            Case "bla1": text1.text = "blablabla"
            Case "bla2": text1.text = "Blah2"
            Case "Blagger": text1.text = "Boo"
            ...
        End Select
    End Sub
     
  17. WoW Sucks

    WoW Sucks Global Moderator
    Banned

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

    Isn't there an easier way for question 22, to save all the typing? =/
     
  18. Nullware

    Nullware Guru

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

    If what you're clicking on in the Combo Box is exactly what you want to appear in the textbox then you can just do this instead of using cases.
    Code:
    Private Sub Combo1_Click()
      Text1.Text = Combo1.Text
    End Sub
    
    About the only thing you can do to shorten the code using cases for different values clicked on is to have a variable store the output before putting it into the textbox like this.
    Code:
    Private Sub Combo1_Click()
      Select Case Combo1.Text
        Case "Hello": a = "Helloooo"
        Case "Hi": a = "Hiiii"
        Case "Cya": a = "Cyaaaaaaa"
        Case "Bye": a = "Byeeeeeee"
      End Select
      Text1.Text = a
    End Sub
    
     
  19. WoW Sucks

    WoW Sucks Global Moderator
    Banned

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

    ahhhh thanks nullware :)

    I didn't think of the first way. :p

    EDIT: New questions added.
     
  20. Cruel__Machine

    Cruel__Machine Guest

    Referrals:
    100
    A few simple questions. :)

    Split function, for both. The hiscores lookup splits the html string at the linefeed char, retrieves the element, and splits again with the "," char and gets the element again.

    And you merely need to split the string "
    hello 3 bye e jazz f dave w covey 6 halo 3 jds"
    at the " " space string.
    Then you can either make a function that strips out all 1 char length string elements... or use a loop to search for elements, skipping those elements. You wouldn't use a for loop for the latter, of course... you'd need a do .. until or w/e so you can define incrementor.
     
< echo in C | Need tutor on Programming >


 
 
Adblock breaks this site