-
Sep 27th, 2012, 04:57 PM
#1
Thread Starter
Hyperactive Member
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
-
Sep 27th, 2012, 05:03 PM
#2
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!
-
Sep 27th, 2012, 05:11 PM
#3
Thread Starter
Hyperactive Member
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
-
Sep 27th, 2012, 05:42 PM
#4
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!
-
Sep 27th, 2012, 06:15 PM
#5
Thread Starter
Hyperactive Member
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
-
Sep 27th, 2012, 07:56 PM
#6
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.
-
Sep 28th, 2012, 09:41 AM
#7
Thread Starter
Hyperactive Member
Re: Command Console
Originally Posted by Niya
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
-
Sep 28th, 2012, 01:49 PM
#8
Re: Command Console
dunfiddlin told you how in post #4
-
Sep 28th, 2012, 02:20 PM
#9
Thread Starter
Hyperactive Member
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
-
Sep 28th, 2012, 02:42 PM
#10
Re: Command Console
Well break up the big problem into little problems and we can help you solve them one by one.
-
Sep 28th, 2012, 03:01 PM
#11
Thread Starter
Hyperactive Member
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
-
Sep 28th, 2012, 03:37 PM
#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).
-
Sep 28th, 2012, 04:18 PM
#13
Addicted Member
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?
\
-
Sep 28th, 2012, 05:49 PM
#14
Re: Command Console
Originally Posted by The Little Guy
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.
-
Sep 28th, 2012, 07:05 PM
#15
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|