Results 1 to 15 of 15

Thread: Command Console

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Command Console

    How can a make a command console in my application? I would like users to be able to type in commands and have them executed. How can I do that?

    I was thinking I could do it with a textbox, so I set one up and set all the properties, now how can I get it to act as a command console?
    I am still very new to VB.NET, so I have MANY questions

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Command Console

    What do you mean by 'commands'? Are we talking an exact clone of the Command Prompt, commands that affect the application, commands that affect third-party applications, a quasi programming language?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    I have MySQL installed, and I would like to run MySQL queries from my application. I then want the result that MySQL returns displayed in my console.
    I want to use a textbox or something similar to do so.
    I am still very new to VB.NET, so I have MANY questions

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Command Console

    So actually nothing like a command console? Assuming that you have a handle on connecting to a database and sending a query, and that you can pass a string from a textbox to a function, I'm failing to see the difficulty here.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    Basically what I am trying to do is make a MySQL version of this:




    I am still very new to VB.NET, so I have MANY questions

  6. #6
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Command Console

    If you already know how to query the database and retrieve the results then you're already 99% of the way there.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    Quote Originally Posted by Niya View Post
    If you already know how to query the database and retrieve the results then you're already 99% of the way there.
    I do, so can anyone tell me how to turn a textbox or richtextbox into a command console?
    I am still very new to VB.NET, so I have MANY questions

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Command Console

    dunfiddlin told you how in post #4
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    I don't see any help.

    The textbox is multilined, and contains pervious queries, so I can not just grab everything from the text box, because it will also contain results and queries from previous actions.
    Last edited by The Little Guy; Sep 28th, 2012 at 02:26 PM.
    I am still very new to VB.NET, so I have MANY questions

  10. #10
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Command Console

    Well break up the big problem into little problems and we can help you solve them one by one.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    1) set an input line. 1 line that asks for input from the keyboard from the rich textbox. When the person presses enter, send the query from that line to be processed.
    Example:
    Code:
    mysql> select * from poll_votes limit 10;
    +--------------+---------+----------------+-------------------+------------+------------+
    | poll_vote_id | poll_id | poll_option_id | poll_reason       | poll_ip    | poll_date  |
    +--------------+---------+----------------+-------------------+------------+------------+
    |            1 |       1 |              1 |                   | 2130706433 | 2012-09-12 |
    |            2 |       1 |              1 |                   | 1205329295 | 2012-09-12 |
    |            3 |       1 |              1 |                   | 2903013018 | 2012-09-12 |
    |            4 |       1 |              1 |                   | 1451979329 | 2012-09-12 |
    |            5 |       1 |              1 |                   | 2742407862 | 2012-09-13 |
    |            6 |       1 |              1 |                   | 1593870240 | 2012-09-13 |
    |            7 |       1 |              1 | am a web designer | 3291186511 | 2012-09-13 |
    |            8 |       4 |             11 |                   | 2903013018 | 2012-09-13 |
    |            9 |       1 |              3 |                   | 2913254010 | 2012-09-13 |
    |           10 |       4 |             13 |                   | 1265382649 | 2012-09-14 |
    +--------------+---------+----------------+-------------------+------------+------------+
    10 rows in set (0.00 sec)
    
    
    mysql> insert into poll_votes (poll_id, poll_option_id, poll_ip, poll_date) values (1, 1, 2130706433, '2012-09-28');
    So when the person presses enter, this line should be executed: insert into poll_votes (poll_id, poll_option_id, poll_ip, poll_date) values (1, 1, 2130706433, '2012-09-28');

    I don't want them to be able to move the cursor/caret away from that line, and they can only use the left/right arrow keys to move the caret. They can also select data to copy
    Last edited by The Little Guy; Sep 28th, 2012 at 03:04 PM.
    I am still very new to VB.NET, so I have MANY questions

  12. #12

    Re: Command Console

    1) Is this a type of homework application? The way you worded your post makes it seem like so unless you were just listing in a different manner.
    2) I'm still not sure what the problem is on how you can't do this, or at least start it yourself. You've already been told what you need (A textbox and a richtextbox for starters, and a button might help). I'll nudge you even further and show you different tutorials to do something like this. But since you want a specific output style from the console, these different articles should help you out.
    3) Some of the above articles are in C#; you can easily translate those to VB.net. I leave that up to you to figure out where and how (it's not difficult; Google can help you).

  13. #13
    Addicted Member
    Join Date
    Oct 2008
    Location
    USA
    Posts
    150

    Re: Command Console

    Seems like an opportunity to build a GUI with drop down boxes etc to allow the user to build the query, then a big buton to send it and a Rich text box to display the output.
    It seems to me also that if you are writing your own program why not go the whole hog and do all the SQL stuff, using say an oledbconnection and oledbdataadapter, datasets etc.

    Or have I got the wrong end of the stick?
    \
    Think.... Question.....

  14. #14
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Command Console

    Quote Originally Posted by The Little Guy View Post
    1) set an input line. 1 line that asks for input from the keyboard from the rich textbox. When the person presses enter, send the query from that line to be processed.
    Example:
    Code:
    mysql> select * from poll_votes limit 10;
    +--------------+---------+----------------+-------------------+------------+------------+
    | poll_vote_id | poll_id | poll_option_id | poll_reason       | poll_ip    | poll_date  |
    +--------------+---------+----------------+-------------------+------------+------------+
    |            1 |       1 |              1 |                   | 2130706433 | 2012-09-12 |
    |            2 |       1 |              1 |                   | 1205329295 | 2012-09-12 |
    |            3 |       1 |              1 |                   | 2903013018 | 2012-09-12 |
    |            4 |       1 |              1 |                   | 1451979329 | 2012-09-12 |
    |            5 |       1 |              1 |                   | 2742407862 | 2012-09-13 |
    |            6 |       1 |              1 |                   | 1593870240 | 2012-09-13 |
    |            7 |       1 |              1 | am a web designer | 3291186511 | 2012-09-13 |
    |            8 |       4 |             11 |                   | 2903013018 | 2012-09-13 |
    |            9 |       1 |              3 |                   | 2913254010 | 2012-09-13 |
    |           10 |       4 |             13 |                   | 1265382649 | 2012-09-14 |
    +--------------+---------+----------------+-------------------+------------+------------+
    10 rows in set (0.00 sec)
    
    
    mysql> insert into poll_votes (poll_id, poll_option_id, poll_ip, poll_date) values (1, 1, 2130706433, '2012-09-28');
    So when the person presses enter, this line should be executed: insert into poll_votes (poll_id, poll_option_id, poll_ip, poll_date) values (1, 1, 2130706433, '2012-09-28');

    I don't want them to be able to move the cursor/caret away from that line, and they can only use the left/right arrow keys to move the caret. They can also select data to copy
    For the time being I will suggest you use a TextBox where the user can type and a ListBox or a read only TextBox above it to show the result. What you actually want is not as straight forward as you might believe. You will actually have to alter the TextBox's behavior to achieve what you describe which is no trivial thing.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    284

    Re: Command Console

    Okay, thanks!

    What I guess I will do is just have a link that opens "mysql.exe" in it's own window
    I am still very new to VB.NET, so I have MANY questions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width