|
relax...I just thought it was not such a hard question for this tremendous community.... In any case, I did not think that my post was particularly "rude", if I offended you or anyone else here at Code Project, my sincerest apologies.
Why does everything have to boil down to money. No I am not paying for support, but I am not paying for you to scowl me because I added a short comment to my own post. A great part of being part of a community is knowing how to interact in a community.
just like you, I am a volunteer as well, and where I can, I help people that need the help.
-- modified at 15:16 Wednesday 25th July, 2007
-- modified at 15:26 Wednesday 25th July, 2007
I am who I am because of who everyone around me is.
|
|
|
|
|
P.S. a simple "I don't know" would have sufficed.....but thanks for your help anyhow.
-- modified at 15:15 Wednesday 25th July, 2007
I am who I am because of who everyone around me is.
|
|
|
|
|
flyingnome wrote: P.S. a simple "I don't know" would have sufficed
How does "Turn the form's KeyPreview on and handle its KeyDown event..." translate to "I don't know how to solve your problem"?? Sounds like a solution that works to me...
|
|
|
|
|
thanks Dave.
I am who I am because of who everyone around me is.
|
|
|
|
|
flyingnome wrote: Is there really no one that knows how to do this?
Give people time to respond if they know. Impatience like that only is going to piss people off and allow them to be less likely to answer your question.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Paul Conrad wrote: Impatience like that only is going to piss people off
I didn't mean to piss anyone off.....just needed some help....sorry if you read the post and wanted to kick your dog.
I am who I am because of who everyone around me is.
|
|
|
|
|
I have a login page that contains user id and password and then a button called ok...
My problem is after typing tha password i have to click the oke button... now i want this to happen on click of any button...like enter
please help me i am new to c#
Thanks Vikas
|
|
|
|
|
There is property on the form, not the button.
After adding the button to the form, on the form set the AcceptButton property on the form. You also have a CancelButton property.
all can be done in form load
IButtonControl ib = (IButtonControl )button1;
this.AcceptButton = ib;
similarly others
|
|
|
|
|
i am doing all this
this.DialogResult = DialogResult.ok
this.Hide();
this.Dispose(true);
Now here this is happening on click the ok button
this i want to happen on click of enter button
Thanks in advance..
vikas
|
|
|
|
|
when you need it Enter Event
handle Key Event.
the form property is perfect.
|
|
|
|
|
right now i have to click on ok button i want after type the password if user click enter button that time event shoud fire to accept this...
|
|
|
|
|
what i suggested will do it for you
just set the property for form it will automatically call Ok button click event if you Enter.
|
|
|
|
|
Thanks ashu.... it is working fine
|
|
|
|
|
Hi am writing a application that have to save rectangle as an xml file.can anyone please help me to save rectangle as xml file using savedialog and xmltextwritter. my code is like this.
Stream myStream;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
XmlSerializer mySerializer = new XmlSerializer(typeof(DocManager));
//StreamWriter wText = new StreamWriter(myStream,Encoding.UTF8);
XmlTextWriter myWriter = new XmlTextWriter(myStream, Encoding.UTF8);
mySerializer.Serialize(myWriter,type);
// myStream.Close();
// myWriter.Close();
//wText.Write(" your xml");
//myStream.Write("your xml");
myStream.Close();
myWriter.Close();
//wText.Close()
Mamphekgo
|
|
|
|
|
Try this...
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK) {
XmlTextWriter w = new XmlTextWriter(saveFileDialog1.FileName, Encoding.UTF8);
w.WriteStartDocument(true);
w.WriteEndDocument();
w.Flush();
w.Close();
}
|
|
|
|
|
Hi
I have one comment, unrelated to the original topic:
like so many people on this web site, you do Flush followed by Close
IMO there is no need for that, every Close has an implicit Flush in it.
The only time you must call Flush (and the reason for its existence) is when you dont Close
right now, but want to make sure the data gets pushed forwards (at least one level).
This may be useful if e.g. you are logging to a file, while another app is trying to show
the latest content of same file.
|
|
|
|
|
Luc Pattyn wrote: IMO there is no need for that, every Close has an implicit Flush in it.
Yes. I think the only time that Flush should be used is if you need to flush out the buffer and keep the file open. Like how you mentioned with the log file...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
This is related to the formatting, not the topic, of your message.
I am preparing an article on copying code snippets from a CodeProject message board to
Visual Studio; seems there are no problems when the browser used is FireFox, Safari, ...
but often problems arise when using Internet Explorer.
One of the factors is the tags that are present inside the < PRE> </PRE> block.
In your message the lines are separated by <br> tags; most other messages have
just regular newlines.
Could you please tell me how you get that, i.e. what tools you use, and how you go
about it. Thanks in advance.
|
|
|
|
|
I'm not sure I understand what you mean. I don't do anything different, and I don't see a difference from other post. Can you explain further?
|
|
|
|
|
It is about copying code snippets FROM CodeProject messages TO Visual Studio.
Seems like most browsers have no trouble, Internet Explorer does.
So if you are not using IE6/IE7 you would not be aware of this.
IE6/IE7 often looses formatting, that is when copied the data on the clipboard, it
does not always represent line breaks and indentation well, pasting it in a
Visual Studio source window drops the newlines, and/or the indentation (space/tabs),
resulting in a complete mess.
It depends on exactly how the HTML code was built in the first place, hence
on the browser the poster is using and the tags he is adding.
Hence my questions: what tools do you use, and how do you go about it
(e.g. which tags do you use normally).
TIA
|
|
|
|
|
Personally, I just type of paste code into a <pre /> tag. I assume code project automatically converts all line breaks into <br> tags.
|
|
|
|
|
|
How to iterate along each and every item of a List<t>?
|
|
|
|
|
foreach (SomeType theItem in someList) {
DoSomethingWith(theItem);
}
---
single minded; short sighted; long gone;
|
|
|
|
|
----
List<int> intList = new List<int>();
//fill the list
//...
foreach(int myInt in intList){
Console.WriteLine(myInt);
}
----
This enumerates over all integers in intList, storing them in the variable myInt inside the loop so that you can access it.
Note that you can't edit the list itself during this loop, so if you are trying to remove an element from the list you will get an exception thrown. The way around this is to make a separate list to store the elements that you want removed, then loop through those later and remove them from your original list OR, see below (looping backwards and removing elements)
----
//loops through intList and removes every 0 from the list
cont int BADVAL = 0;
for(int i = intList.Count - 1; i >= 0; --i){
if(intList[i] == BADVAL){
intList.RemoveAt(i); //removes the current index from the list
}
}
----
|
|
|
|