Basic help

Discussion in 'Programming General' started by Burden, May 15, 2009.

Basic help
  1. Unread #1 - May 15, 2009 at 1:22 AM
  2. Burden
    Joined:
    Dec 30, 2008
    Posts:
    894
    Referrals:
    0
    Sythe Gold:
    0

    Burden Apprentice
    Banned

    Basic help

    I am working on this for a game I play were I will have kick power, since I am lazy.

    [​IMG]

    I set up the boxes ect as I did always in VB6, however this time in .NET, I don't have the code for the stuff I setup, I only have this.


    Code:
    Public Class form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub sendButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sendButton.Click
    
        End Sub
    End Class
    
    How do I set values to each listbox item, and the button onClick to use sendkeys to type?

    Also, how can I have a hotkey for this that will activate in the background and type in the currently open window?

    Many <3's, this is a lot different than VB6...
     
  3. Unread #2 - May 15, 2009 at 3:45 AM
  4. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Basic help

    It isn't very different at all. It is actually easier.

    I suggest you look up how to use Hashtables for the values, and use the text of the list item as the hash key. Hashtables are like arrays, except rather than accessing the elements of the array with the number of the element, the "key" is what you use to get the values rather than a number. The key us generally a string.

    SendKeys is deprecated and SendMessage is better (but a lot harder), but in .Net you would use SendKeys.Send().

    For hotkeys, look up methods on checking whether or not keys have been pressed, or look up the RegisterHotKey() API.
     
  5. Unread #3 - May 15, 2009 at 8:41 PM
  6. Burden
    Joined:
    Dec 30, 2008
    Posts:
    894
    Referrals:
    0
    Sythe Gold:
    0

    Burden Apprentice
    Banned

    Basic help

    Thanks so much.

    Ok, so I have this set up:

    Code:
    SendKeys.Send("` " & (userBox.Text) " " & (infList.Text) & (levelList.Text))
    
    
    The bolded part has an error.
    Comma, ), or a continued expression expected.
    Also, could I just use
    Code:
    SendKeys.Send(key combination for alt+Tab here.)
    ?
     
  7. Unread #4 - May 15, 2009 at 10:15 PM
  8. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Basic help

    There is no bolded part. But this should work:
    Code:
    SendKeys.Send("` " & (userBox.Text) & " " & (infList.Text) & (levelList.Text))
    You forgot an "&".

    EDIT: Swan! Stop saying this is easier, before I rip off your face.
     
  9. Unread #5 - May 16, 2009 at 12:17 PM
  10. Burden
    Joined:
    Dec 30, 2008
    Posts:
    894
    Referrals:
    0
    Sythe Gold:
    0

    Burden Apprentice
    Banned

    Basic help

    Oh, jeeze that was a dumb mistake, many thanks.

    EDIT: Now it sends a million things to the kicklog.txt, and freezes.
    I don't see where/why it should be looping, and it also that I know of isn't typing out the command.
    EDIT: Here's my updated code.

     
  11. Unread #6 - May 16, 2009 at 8:13 PM
  12. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Basic help

    But it is easier. Very much so. Lrn2OOP :D
     
  13. Unread #7 - May 16, 2009 at 9:50 PM
  14. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Basic help

    I can't see why it would loop either. :\

    EDIT: What the hell does "Sx.Flush()" do? Try commenting out that line, I don't know why it's there. (BACK IT UP!)

    -

    lrn2ControlArray
     
  15. Unread #8 - May 16, 2009 at 10:23 PM
  16. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Basic help

    StreamWriter.Flush() flushes the data from the stream.

    And also, control arrays? That useless feature? What are you talking about?
     
  17. Unread #9 - May 17, 2009 at 1:18 AM
  18. Burden
    Joined:
    Dec 30, 2008
    Posts:
    894
    Referrals:
    0
    Sythe Gold:
    0

    Burden Apprentice
    Banned

    Basic help

    Oh, my.
    FIGHT!

    I'll try commenting it out and edit what it does in.
    I'm pretty sure that will kill the entire write to text file though.
     
< Need testers for my AutoTalker | C/C++ Tic-Tac-Toe Console Game Log >

Users viewing this thread
1 guest


 
 
Adblock breaks this site