|
|
You could also try using the latest version of Managed DirectX.
Playing audio with that is quite simple.
Try searching the articles for examples.
Kev
|
|
|
|
|
hello,
I made a simplest chatting application using UdpClient, it was working fine until I installed Win XP SP2. Now the messages are not being received at the other end. No Exceptions, nothing at all.
I even disabled the Windows Firewall that comes with SP2, still no hope. My application is still working fine on loopback, but nothing after it. I am using port 20052.
Can anyone explain what am I missing?
Regards,
Zishan
|
|
|
|
|
The reason may cause of security and firewall features avilable in XP SP2. What you can do is find out proper restriction areas where your client communicate with your requested machine.
And i recommand you to read more about Features and Techinical Overviews of SP2.
Learn About SP2
Techinological Overview This will give you some more ideas.
Techinical Look At SP2
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Thanks for the reply.. yes it started working.. nice articles..
Regards,
Zishan
|
|
|
|
|
In my customer form there are few text box's for enter Data.i have set up sequence of tab no's for those text box's.What i want is to move cusor from
text field 1 to text field 2 by pressing Enter Key.
How can i do this by using c#.
Can any one Please Help me.
Amal
|
|
|
|
|
Place the following code in textbox1's keydown event. Repeat for all other textboxes accordingly.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
textBox2.Focus();
}
|
|
|
|
|
Here is a better solution. Place this code in a common keydown event between all the textboxes. Then set the taborder of the textboxes in the order that they sould be focussed.
private void textBox1_KeyDown_1(object sender, System.Windows.Forms.KeyEventArgs e)
{
int i = ((TextBox)sender).TabIndex;
if (e.KeyCode == Keys.Enter)
{
foreach (Control c in this.Controls)
{
if (c is TextBox)
{
if (((TextBox)c).TabIndex == i + 1)
{
c.Focus();
}
}
}
}
}
|
|
|
|
|
To set and view the Tab order, On the View menu, choose Tab Order which is avilable in .NET IDE.
to select control using enter key, use below mentioned code block.
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
<br />
if(e.KeyValue==13)<br />
{<br />
this.SelectNextControl(this.ActiveControl,true,true,false,true);<br />
}<br />
<br />
}
The above code block is only tip to achive your requirement.
Please see more details on SelectNextControl Method for different style of selection and parameter types in MSDN.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Sreejith, Sorry for the interruption in between. I doubt whether Form's KeyDown event will get fired, If textBox has the focus.
I feel, It would not solve the purpose. You should call the SelectNextControl method in the KeyDown Or KeyUp event of the textbox.
|
|
|
|
|
Dear friens,
Above problem working with windows forms.but my problem is how do we apply above things in webforms.cas in asp.net ,textbox don't have focus property right.
How we set enter key operations on asp.net.
Thanks
|
|
|
|
|
does any one know how to make a grand staff since i think i would have to use gdi+ since .net doesn't support making custom controls, any ideas on how to start though?
IM PROUD TO BE A GMAIL;
|
|
|
|
|
You Wrote:
does any one know how to make a grand staff
What sort of control that you are looking for ?
Sreejith Nair
[ My Articles ]
|
|
|
|
|
tom_dx wrote:
make a grand staff
What's a "grand staff"?
tom_dx wrote:
since .net doesn't support making custom controls
What do you think is limiting you?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
DOH!!! , obviously he needs a "Lesser Staff" to inherit from
and that is missing in .NET
//Roger
|
|
|
|
|
Another thing I missed when reading the .NET Framework SDK!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I wrote a .NET Windows service that spawns a thread which periodically performs some DB related work. When the service starts, it spawns the thread, when the service stops, it aborts the thread.
The thread sleeps for 30 seconds, then wakes ups and querys some DB values, then sleeps again in an infinite loop.
A friend suggested that I Use a timer instead of a sleeping thread, and I could not think of an explicit reason why each approach is better. What approach would you take and why?
Thanks,
Jeff
|
|
|
|
|
I will always prefer Thread.Sleep(xxxx).
We have facility to make the thread sleep for required seconds. Then why shold i use timer here.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Because, IIRC, a Sleeping thread won't respond to ANYTHING until it wakes up again. Do you want to wait 30 seconds for the thread to abort, or the service to stop, or its interface to respond, or ... ?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Exactly.
You cannot wake up a sleeping thread prematurely, so you have to wait for the thread to wake up before you can abort the thread etc.
If you used a timer, you could fire your processing method every 30 seconds and still be able to "fire" it in between conditionally.
e.g. Admin connecting to service, requesting another db-op on the same db with non-standard commands etc.
|
|
|
|
|
hello all
i do this code in db but parse give me this erro "input string not in the correct format" When i leave the field parsed blank (textBox2.text)
"Insert INTO test (Name,age,address) Values('"+textBox1.Text+"','"+decimal.Parse(textBox2.Text)+"','"+textBox3.Text+"
Regards
haytham
|
|
|
|
|
This is what I mean by string concantenation. Don't EVER do this! Use parameterized queries instead. What you doing now results in goofy error you have trouble nailing down and also REALLY opens your code up for SQL injection attacks. For examples, check out the SqlParameter class[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The Decimal type can't parse an empty string. It's as invalid a decimal as "Frank" is.
Either make sure you're only dealing with valid values in the TextBox before you parse it or catch the FormatException that will be thrown otherwise. You'll get better performance validating the input, though.
By the way, when Dave Kreskowiak asked you about using string concatenation to build your SQL statement a few posts down, this is what he meant.
A much better way is to use parameters in your query. The exact syntax varies from provider to provider, but here's an example:
OleDbCommand command = new OleDbCommand("Insert INTO test (Name,age,address) Values(?, ?, ?)");
command.Parameters.Add(new OleDbParameter("Name", _name));
command.Parameters.Add(new OleDbParameter("Age", _age));
command.Parameters.Add(new OleDbParameter("Address", _address));
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hello Charlie,
Thanks for your help...
i try this code but give the same error
SqlConnection cnn = new SqlConnection();<br />
cnn.ConnectionString = "workstation id=SERVER;packet size=4096;integrated security=SSPI;data source=SERVER;persist security info=True;initial catalog=TestDB";<br />
SqlCommand cmd = new SqlCommand("Insert INTO test (Name,age,address) Values(@Name,@age,@address)");<br />
<br />
cmd.Parameters.Add(new SqlParameter("@Name",SqlDbType.VarChar));<br />
cmd.Parameters["@Name"].Value = textBox1.Text;<br />
<br />
cmd.Parameters.Add(new SqlParameter("@age",SqlDbType.Decimal));<br />
cmd.Parameters["@age"].Value = decimal.Parse(textBox2.Text.Trim());<br />
<br />
cmd.Parameters.Add(new SqlParameter("@address",SqlDbType.VarChar));<br />
cmd.Parameters["@address"].Value = textBox3.Text;<br />
<br />
<br />
<br />
cnn.Open();<br />
cmd.ExecuteNonQuery();<br />
cnn.Close();
please help
Thanks
|
|
|
|
|
Hello Charlie,
Thanks for your help...
i try this code but give the same error
SqlConnection cnn = new SqlConnection();<br />
cnn.ConnectionString = "workstation id=SERVER;packet size=4096;integrated security=SSPI;data source=SERVER;persist security info=True;initial catalog=TestDB";<br />
SqlCommand cmd = new SqlCommand("Insert INTO test (Name,age,address) Values(@Name,@age,@address)");<br />
<br />
cmd.Parameters.Add(new SqlParameter("@Name",SqlDbType.VarChar));<br />
cmd.Parameters["@Name"].Value = textBox1.Text;<br />
<br />
cmd.Parameters.Add(new SqlParameter("@age",SqlDbType.Decimal));<br />
cmd.Parameters["@age"].Value = decimal.Parse(textBox2.Text.Trim());<br />
<br />
cmd.Parameters.Add(new SqlParameter("@address",SqlDbType.VarChar));<br />
cmd.Parameters["@address"].Value = textBox3.Text;<br />
<br />
<br />
<br />
cnn.Open();<br />
cmd.ExecuteNonQuery();<br />
cnn.Close();
please help
Thanks
|
|
|
|