|
Is this VB.net code? I only have VB 6. I'll see if I can adapt it.
Thanks for your help.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
I was working on a basic tut to make a guessing game. The prog picks a random number from 1 to 10 and you have to try to guess it. It tells you if you guess too high or low or guess correctly. I want to add a reset button to start the form over and run the random number genreator again. I want to be able to play again without closing and relaunching the .exe file. Can anyone give me any idea of how to do this?
Thanks,
Glisson
|
|
|
|
|
Add 2 labels, 2 buttons and one textbox
private System.Windows.Forms.Button btnCheck;
private System.Windows.Forms.TextBox txtGuess;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Label lblMessage;
WRITE THIS CODE IN EVENTS:
private int randomNumber = 0;
private void btnReset_Click(object sender, System.EventArgs e)
{
GenerateRandomNumber();
}
private void Form1_Load(object sender, System.EventArgs e)
{
GenerateRandomNumber();
}
private void GenerateRandomNumber()
{
this.txtGuess.Text = String.Empty;
this.lblMessage.Text = String.Empty;
Random rand = new Random();
// Generate a random number between specific intervals (1 and 10.)
this.randomNumber = rand.Next( 1, 10 );
}
private void button1_Click(object sender, System.EventArgs e)
{
try
{
string data = txtGuess.Text.Trim();
if(data == string.Empty) return;
int number = Convert.ToInt32(data);
if(this.randomNumber == number)
this.lblMessage.Text = "Correct";
else if(this.randomNumber > number)
this.lblMessage.Text = "Low";
if(this.randomNumber < number)
this.lblMessage.Text = "High";
}
catch{}
}
}
}
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
Hi,
I'm wanting to track the clicks a user takes through a menu in a Pocket PC VB.net App (.net compact framework)
Clicks are not registering when a user clicks a sub menu?
Does anybody know how to call the 'Popup' event when a user click on a sub menu?
Thanks in advance.
|
|
|
|
|
Your question would be better handled in the Embedded/Mobile forum, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can i protect my application using the computer's registry files ??
Thnx
|
|
|
|
|
"Protect"?? - you can't. It's such an easy method to get around it's not worth the effort. Check into professional security package. Just Google for "developer application copy protection".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
I am trying to compact and repair an access 2000 d/b from within vb.net using this code from microsoft:
Dim jro As JRO.JetEngine<br />
<br />
jro = New JRO.JetEngine()<br />
<br />
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\nwind.mdb", _<br />
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NewNwind.mdb;Jet OLEDB:Engine Type=5")<br />
<br />
MsgBox("Finished Compacting Database!")
The problem is that when I try to replace the both the source and the destination file with application.startupath and my file name, vb.net breaks at the MsgBox line saying the the file is not found.
I have to use application.startupath in order for my app to find the database upon deployment.
I think the problem is that I do not knmow how to use application.startupath in this instance.
Any help?
|
|
|
|
|
SourceDB = Application.StartupPath & "\yourDataBase.mdb"
BackupDB = Application.StartupPath & "\yourDataBase.mdb.bak"
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SourceDB, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & BackupDB & ";Jet OLEDB:Engine Type=5")
|
|
|
|
|
The more correct way would be to use the Combine static method of the Path class to combine the filename and StartupPath.
Imports System.IO
.
.
SourceDB = Path.Combine(Application.StartupPath, "yourDataBase.mdb")
BackupDB = Path.Combine(Application.StartupPath, "yourDataBase.mdb.bak")
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SourceDB, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & BackupDB & ";Jet OLEDB:Engine Type=5")
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I'm trying to build a little MP3 player application in VB 6. I need some sort of reference on the properties and methods of the Windows Media Player 9 ocx control. wmp.dll
If anyone could help me out I'd appreciate it. Thanks.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
i think this is what you're looking for...
-jim
|
|
|
|
|
Yeah, I was just looking at this page when your reply came in. It's not much help actually. I was looking more for a sample project that uses all the functions. I did a google search on it but didn't find anything free, or in English.
[Edit:]
Hold the phone. One of the deep-level branches had the references I need. I just found it. Thanks.
Now if only I can get it to work.
[Edit2:]
The darn thing doesn't say how to play, pause, and stop the thing programmatically.
[Edit3:]
But I'm a curious fellow, and I figured it out on my own. Ain't that always the way...
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Hi everyone!
I have a Word document that contains linked and embedded Excel worksheets. I need to determine the range of cells that get displayed in the Word document. For a linked worksheet, I get the cells range from the InLineShape.OLEFormat.Label property. But this does not work for embedded InLineShapes. Does anyone know where/how to get the embedded worksheet cells range for embedded worksheets?
Thanks.
Robert
|
|
|
|
|
I would like to know if someone is familiar with Quark File. I must absolutely know how to extract informations conatined in these files. Someone can help me ?
I am a newbie
|
|
|
|
|
Which program?
Quark Publishing or Quark the Game?
What Type of Information?
|
|
|
|
|
Quark XPress, the name of the textbox, picturebox, document, all that is in the file, all i can get from it with a streamreader is that :
IIXPR3B B DC 2UÈA` ¥Ó¦Sü¥SÑø €$ €$ €$ €$ $ d )z 33 $ $ š §Ó d $ §ÓšýçÓçü {T {T € € À À € ìþûsUU 3ó Ý$ Ý$ % $ 5^ ü°
I am a newbie
|
|
|
|
|
Unless you can find documentation on the file format for a Quark Express file, your wasting your time. Opening and reading a binary file is simple. Intelligently interpreting the contents and pulling out the information you need is impossible without the format documentation.
The only other way to do it without the docs is if Quark Express exposes a COM interface like WOrd and Excel does.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That won't be easy to do, But
Here's someone working on it.
Check here for more info,
Reverse engineering the Quark Xpress file format.
http://home.planet.nl/~faase009/QX.html
|
|
|
|
|
I need to have a timer execute some commands for fixed time periods in visual basic. The timer should start when the application starts and when time reaches 5 or 10 min execute a command, then the next 5 or 10 min later it should execute another set of commands. Im new to visual basic so I see a see an if else type of code or case structure:
if timer< 10 min
//code
else if timer > 10 min
// code
etc
or a case statement. Can someone provide a simple sample code for doing this.
Thank you.
|
|
|
|
|
First, your app should save the system time somewhere convient when the app starts. Start your timer, set for an interval of 60 seconds. In the Elapsed event for the timer, check the current time against the saved time to see if your in that 5 to 10 minutes range. That's when you'll kick off your commands.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can I use a USB-port like a COM-port , where I can open a port with the API-function:
hCOM1 = CreateFile("\\\\.\\COM1",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,NULL,NULL);
and write to it:
writeOK = WriteFile(hCOM1,buf,cnt,&bytesWritten,NULL);
Or is there an other simple way to replace a serial COM-communication with USB ?
Thanks !
|
|
|
|
|
jobr1ch wrote:
Can I use a USB-port like a COM-port
No, you can't. Not unless the device driver exposes such functionality. Most devices won't do that, but it all depends on what your trying to do with what device.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can I code a messagebox to show when the datagrid column is not selected or selected more than one row? when data first load or reload to datagrid, no row is selected. is there any way I can set the datagrid can only select one column at a time?
Lisa
|
|
|
|