|
OK,
Never worked with this.
But if the focus is on the textbox, does the Form react also?
Or do you have to set KeyPreview to true additionaly?
All the best,
Martin
|
|
|
|
|
No, the focus can be anywhere on the form
|
|
|
|
|
Thanks!
Maybe I need it someday.
All the best,
Martin
|
|
|
|
|
I have a C# windows application...
MY DESIGN:::
IP Address- textbox
Port number- textbox
Msg to server-textbox//client msg to be searched in d xml file
Connect and Send-Buttons
Msg from server-textbox//Display corresponding reply from xml file thro TCP server.
I need to Create a TCP Client server, where the client windows gets the request to the server, searches and fetches the corresponding reply in an XML file, and displays it to server window n also to the client window as a note of acknowledgement...
CAN SOMEBODY HELP ME WITH A CLEAR CODING????? Im on my final project... i need this small task...
|
|
|
|
|
wrote: CAN SOMEBODY HELP ME WITH A CLEAR CODING????? Im on my final project... i need this small task...
What you're asking for is so trivial to do, I'd suggest you read about XmlDocument and Sockets.
It sounds like you're asking us to do your project for you. We don't get the grade, YOU do. I'd suggest you figure out how to do it yourself.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Tats nice!!
But the thing im not able to do is merging...I hav a tcp request reply of the sort in a windows application... i hav done an XML read document already. but if u can merge for me a simple logic which im waiting for, it would be more sensible..
Keep Smiling Bcoz it costs Nothing-
Janani Vaithyanathan
|
|
|
|
|
Hello All,
I'm using a GridView in Windows Form. I have one Column which is of type ComobBox. I'm able to assign values in ComboBox but i'm not able to set default value to it. eg: Suppose there are 5 values say a,b,c,d,e. Now i want to set a as defualt value. this value may change depeding on conditions.
Any help will be appreciated. Thanx in advance.......
Regards,
Rahul
|
|
|
|
|
get the control reference first and try setting the default value to the one u want. Something. cmbbox.selecteindex[0]='ab';
|
|
|
|
|
hi,
thanx for ur reply. there is no such property called combobox.selectedindex[0] in DataGridView
Regards,
Rahul Pawar
|
|
|
|
|
I'm using Leon v Wyk's sample code to send a fax and I was successful to send the fax. However I will be sending around 60 fax an hour and I have added a new Modem with another telephone line to my computer. How can I check this code if Modem 1 is busy to use Modem 2?
|
|
|
|
|
hello fellow Brains
i'm trying to find the number of occurrences of a particular character in a string.
How can i do it???
|
|
|
|
|
myString.Length()-myString.Replace(myChar.ToString(),"").Length()
will do it,
and I am confident some regex expression could do it too.
Luc Pattyn
|
|
|
|
|
Oh Brainy one!
How do i replace a character only till its second last occurence? i.e. leave the last occurence of a character in a string as it is?
|
|
|
|
|
Use LastIndexOf, then do a replace on the substring up to that point.
|
|
|
|
|
Exactly, unless it is all about a file path, then you might want to use the Path class for
what you really want (seems like a moving target).
Luc Pattyn
|
|
|
|
|
Just use a for loop
<br />
char ch = 'l';<br />
int count = 0;<br />
string str = "hello";<br />
<br />
for(int i = 0; i < str.Length; ++i) {<br />
if(str[i] == ch)<br />
++count;<br />
}<br />
|
|
|
|
|
hi can anyone tell me the ways of hosting remotable objects?
Thanks
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
|
Hello!
(Sorry, my English knowledge is not perfect, but I hope, that my words can be understood
I have a problem with processing arrow keys. I have a Form and a PictureBox on it. I want to move a small drawing on the picture box, and it works with the W,A,S,D keys, but nothing happens when I press the arrow keys. For test purposes I've put a label on the form to display the codes of the pressed keys and I've seen that even shift, home, pageup/down, etc. keys are processed, but the arrow keys do not seem to make a KeyDown event.
(I tried the form's KeyPreview property, but it did not help.)
Can anybody help me?
Here is my code code for the event:
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
lblStatus.Text = "KeyDown : KeyCode = "+e.KeyValue.ToString();<br />
if ( (e.KeyCode == Keys.Right) || (e.KeyCode == Keys.D) ) <br />
{<br />
NextDirection=0;<br />
lblStatus.Text = "Right";<br />
}<br />
if ( (e.KeyCode == Keys.Up) || (e.KeyCode == Keys.W) ) <br />
{<br />
NextDirection=1;<br />
lblStatus.Text = "Up";<br />
}<br />
if ( (e.KeyCode == Keys.Left) || (e.KeyCode == Keys.A) )<br />
{<br />
NextDirection=2;<br />
lblStatus.Text = "Left";<br />
}<br />
if ( (e.KeyCode == Keys.Down) || (e.KeyCode == Keys.S) ) <br />
{<br />
NextDirection=3;<br />
lblStatus.Text = "Down";<br />
}<br />
}
|
|
|
|
|
Have you tried placing the code in other methods? Keypress, etc?
|
|
|
|
|
Thanks for the advice. Unfortunately it doesn't work. Using KeyPress event provides a KeyPressEventArgs type variable, which has information on the character only
(char KeyPressEventArgs.KeyChar), there is no chance to get information on special keys.
|
|
|
|
|
|
That works!!!
Thanks a lot for this link. Probably I did not use the proper keywords in google, so I did not find this page. Anyway, thanks again. Bye!
|
|
|
|
|
private int left = 0;
private int top = 0;
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyData)
{
default :
break;
case Keys.Up :
top -= 1;
break;
case Keys.Down :
top += 1;
break;
case Keys.Left :
left -= 1;
break;
case Keys.Right :
left += 1;
break;
}
DrawIt();
}
private void DrawIt()
{
Bitmap b1 = new Bitmap(10, 10);
Graphics g = Graphics.FromImage(b1);
g.FillRectangle(new SolidBrush(Color.White), new Rectangle(new Point(0, 0), b1.Size));
Bitmap b2 = new Bitmap(this.Width, this.Height);
g = Graphics.FromImage(b2);
g.DrawImage(b1,new Point(left,top));
this.BackgroundImage = b2;
this.Invalidate();
}
|
|
|
|
|
I'm scratching my head over a solution to a problem. The answer I have come up with seems to work but a little voice in the back of my head tells me it's not good design. I'm looking to find out what other people think.
I have an abstract Base class called MessageBase
I have concrete subclasses called SystemMessage, ErrorMessage etc.
at one point i had a static class called MessageFactory which read the element name of an XML node and returned the appropriate Concrete class. Now, however, i have moved the factory method into the Base class, MessageBase. This looks tidier all-round but i'm worried that i now have a superclass that knows too much about its subclasses.
Does this design sound good or is it asking for trouble when i've added a few nw messages
Thanks
Russell.
|
|
|
|