|
if the packet definition has N characters for something, then you must provide N characters; you can't transmit "null" can you? You could initialize to all spaces though.
Furthermore, be aware of the fact that .NET characters are Unicode, hence 16-bit, sooner or later you probably need to convert them to/from ASCII.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hi boys
how can i insert into database all datagridview items with foreach...?
|
|
|
|
|
h_floppy wrote: with foreach
Inserting data in database through foreach
जय हिंद
|
|
|
|
|
help me to insert the data from the datagridview.
|
|
|
|
|
Hello,
I've embedded a MaskedTextBox in a UserControl and added it to the ToolStrip of a Form via ToolStripControlHost:
private void Form1_Load(object sender, EventArgs e)
{
ToolStrip1.Items.Add(new ToolStripControlHost(new UserControl1()));
}
In the Validating event of the MaskedTextBox in my UserControl the value of the Text is checked and if necessary corrected:
private void maskedTextBox1_Validating(object sender, CancelEventArgs e)
{
if (maskedTextBox1.Text == "0")
{
maskedTextBox1.Text = "1";
maskedTextBox1.SelectAll();
e.Cancel = true;
}
}
The user can give any input in the MaskedTextBox, validation should only occur when "leaving". If the focus "leaves" the MaskedTextBox (by the user clicking anywhere or tabbing), validation is performed.
If validation fails ( in this case Text = "0") a corrected value ("1") is set, no events (e.g. button clicks) occur outside the control and the control's text should be highlighted
After the value was automatically corrected (the user has been shown a warning... not relevant), he can now of course "Leave" without ado.
If the UserControl is added to a Form all the described behaviour occurs.
However as the userControl is put in a ToolStripControlHost I can't get the text of the MaskedTextBox highlighted after the validation of the maskedtextbox (inside the toolstrip) fails.
Any help on this would be sincerely appreciated.
|
|
|
|
|
Hi,
I've solved my problem, be it in a manner which could as well be posted under coding horrors:
In the validating event of the maskedTextBox I call on a timer (which was added to the userControl), and let its Tick event set the focus.
private void maskedTextBox1_Validating(object sender, CancelEventArgs e)
{
if (this.maskedTextBox1.Text == "0")
{
timer1.Start();
e.Cancel = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
this.maskedTextBox1.Text = "1";
this.maskedTextBox1.Focus();
this.maskedTextBox1.SelectAll();
timer1.Stop();
}
Cheers.
|
|
|
|
|
I spent several hours trying to get this working, and to no avail until I stumbled upon your answer.
Whatever dark magic you've applied to this task in order to arrive at using a timer, I take it your journey as a sorcerer is already a colourful one.
Thanks alot sir.
|
|
|
|
|
|
myventsi wrote: I don' t get the structures of connections and etc
This [^]is possibly one of the simplest example you could find.
Anyways, you need to buy a good book on C# and start reading it.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Suppose I want to call a function whenever I'll press Control + N together.
Now I know I need to catch the keyPress event. But how can I catch two key in one event..?
Thanking In Advance
Johnny
|
|
|
|
|
You need to use either KeyDown or KeyUp events.
if (e.KeyData == Keys.N && e.Modifiers == Keys.Control)
{
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
Hello,
I have a web site with files and direcotires (with files and other directories and files.....in each).
I need to find a particular file in this site (i will provide the main site and it will search recursively inside it and inside the folder to find the file i need). How can i do it?
|
|
|
|
|
First of all this should be in ASP.Net forum.
Use the DirectoryInfo and FileInfo classes to perform the search.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
ok,
And it can search in web sites too?
BTW- i want to do it in C# windows application and not in ASP.NET
|
|
|
|
|
Well, that can do the search everywhere provided you have the read access in that website.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
OK . But in which format do i need to write the website URL?
like this?
DirectoryInfo myDir = new DirectoryInfo("http://www.yahoo.com");
?
Or how?
|
|
|
|
|
Heloo Experts!!!
I am upadating date in my grid.on refresh button click it must show upadated date. i m using Datagrid.refresh() method for same.But cant work;
tel me way.using C# & SQL 2005
Please help!!
|
|
|
|
|
Hi my friends;
I have a different problem. I have a main form that is MDI parent of other forms. I use speech recognition, and I started it as a thread in my main form. It works fine while opening child forms or closing them. But problem begins here. For example I have an active MDI child that have a method or button click event. How can I call the method of my active form from it's MDI parent. I want to do this because I use speech recognition, I want to guide program with my voice commands. Like following I want call DoJob method.
Form frm = this.ActiveMdiChild;
frm.DoJob();
Thank you.
|
|
|
|
|
Not sure which exactly is your problem, but you can do it this way:
1) In the child form, the DoJob() method must be either public or internal (in order to enable access from the parent form).
2) In your parent form you can do something like:
ChildForm cf = (ChildForm)this.ActiveMdiChild;
cf.DoJob();
where ChildForm is your child form's class name.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
You mean you need to call the method accros threads? If so:
frm.Invoke(new MethodInvoker(delegate() { frm.DoJob(); }));
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello Friends.
Suppose I have two functions name
GetBUUser(); && GetISUser(); And both these function call a function name
LoadUserBUStatus(); Now in LoadUserBUStatus() function how do I know which is the caller function..? I hope I made myself clear..
Thanks in Advance..
Johnny
|
|
|
|
|
You need to use Reflection and the Stack. Check out this[^] article.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Ok, I'll bite, why not use a wherefrom parameter, reflection and the stack seems both convoluted and expensive. I can understand if he has no control of the design of the calling methods but he implies he is writing them.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
When I read the question I immediately remembered needing to do something like this before and how I solved it. It was painful which is why it's imprinted on my memory and popped straigt to the tips of my fingers.
In my situation, I couldn't alter the parameters received without breaking other stuff (I can't remember why an overload wasn't allowed, but there was a reason), so sending an additional parameter in the calling method wasn't an option for me.
I agree, a 'whereFrom' parameter would definately be easier for the OP.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|