|
If I have a situation where firing an event causes the event to fire again, or similar, I tend to use a flag to tell me when I want the event firing code to run, and when I need to ignore it.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Graus is true, but i suggest you to use following when binding comboBox to a data source.
you have selected index change event for combo box, you can simply de attach that event before binding comboBox or what ever causes comboBox change index event to fire.
i have a combobox named "cmb1" with selectedIndexChangeded named "cmb1ChangedIndex".
simply follow this
cmb1.selectedIndexChanged -=selectedIndexChangeded;
//do binding here for both comboBox or what ever cause comboBox selectedChanged event //to fire then
cmb1.selectedIndexChanged +=selectedIndexChangeded ;
|
|
|
|
|
Right never used a flag but will research into it and also go with the bidning solution.
Many thanks for you replys
I will try the code the solution tonight ( fingers cross it works)
I will post a heads up and let you know
Thanks again
D.Arnold
dave1816
|
|
|
|
|
|
I have many applications which were working fine but ever since the DBA's re-installed SQL now some of the applications do not work. I tried everything and I could not find a solution. During SqlConnection's Open() method I get the following exception:
"Instance Failure"
Since the message is so descriptive (right!), it is hard to tell what the problem is.
I tried to connect to it by adding a new datasource to a dummy project using VS2005 and give me the same message in a message box. Now I know it is not my app but something else.
Any idea what could be causing this? It only happens with servers that have instance names and not the default.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi,
This[^] might help.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks but as I said I tried everything (almost) but it did not solve my problem. I was hoping someone here have experienced the same and can help me.
I have visited all those links where your trick takes me.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
What's the quickest way to test/check the current node when doing a loop whether that node has it's own subtree of nodes? Or rather that it just has a value.
like:
while (xr.Read())
{
//xr.checkforsubtree
If I do a:
xr.ReadElementString(); - then it advances the current node as well
I want some kind of if statement to check it before hand.
if xr.hasvalue does not work
}
|
|
|
|
|
The problem with the XmlReader class is that it can't predict the future. You can't find out if there are child nodes to the current node you just read without reading through the child nodes. If you really need this, try looking at XmlDocument instead where you read the entire XML file, then you can sift through all the nodes to get the information you want.
|
|
|
|
|
Hi.
I'm gonna create a textbox as when a user press Enter key, <br /> insert into the textbox instead of \n or \r\n
Could you guide me ?
Thanks
|
|
|
|
|
Hi,
Controls that accept keyboard input have KeyDown, KeyUp, KeyPress events. Use one or more of them to achieve your goals.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks . I know them.
I don't know how I can implement it
|
|
|
|
|
They did invent a beautiful thing especially for you, it is called documentation.
If you don't know where it is, Google may show the way. Studying a book on the subject might be useful too.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
use KeyDown event, check if its Enter Key or not. If yes
TextBox.Text = TextBox.Text.Replace("\r\n", "<br />");
or
TextBox.Text = TextBox.Text.Insert(TextBox.SelectionStart, "<br />");
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thank you Xmen W.K.
But your code doesn't work.
It inserts both of <br /> and \r\n
I've used this code, it works.
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
TextBox textBox = sender as TextBox;
if ((int)e.KeyChar == 13)
{
try
{
e.Handled = true;
textBox.Text += "<br />";
}
catch { }
}
}
|
|
|
|
|
Well, it wasn't full code. But your code is a bit buggy What if the carret position is in the middle of text ?
Thats why use string.Insert as I posted above.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hello everyone!
I am looking for some training on a low budget. I do have several books, but was hoping that someone had some video courses they want to get rid of. I also do have a subscription to LearnVisualStudio, but some of their content is older than what I need.
Looking for:
C# (3.0 ideally)
ASP .NET 3.5 is a bonus as well.
AppDev has great training, so if anyone has their training they could sell or lend, that would be great.
|
|
|
|
|
|
These are okay and I did know about them, but they are very specific.
I am looking for content as verbose as AppDev.
I know that usually cost $$$, but I am hoping someone out there has materials they no longer use.
-Brian
|
|
|
|
|
Can anyone tell me how to open any file using its default program ?
|
|
|
|
|
Hi,
Process.Start("file") simulates double-clicking the file in Windows Explorer.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi
I am working on a project that will use tabbed interface for displaying multiple documents (like Visual Studio). I can either I treat it like MDI interface (setting IsMdiContainer to true ) and deal with the difficultis of making it actually tabbed (AFAIK this is not exactly straightforward). Or (my preference) forget about MDI and simpliy open individual documents in individual tabs and that's it.
What is the advantage of the former approach?
Thanks for clarification, H.
|
|
|
|
|
Hi H,
I just built an application using the approach you mention (tabbed with an MDI on the outside). I find that this interface works extremely well for a large number of applications. In particular, the ability to constantly show navigation / menu bar / etc on the MDI parent.
I used Infragistics tool suite to build out the interface - they have a component that actually makes MDI children tabbed - and abstracts most of the work for you. I highly recommend checking it out! The component is called UltraTabbedMDIManager ...
|
|
|
|
|
Principally I guess that in standard MDI you can have multiple views on the screen at once where tabs kind of limit it to one. Some 3rd party docking controls allow you to go either way by dragging views around - like in Visual Studio.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: Principally I guess that in standard MDI you can have multiple views on the screen at once where tabs kind of limit it to one.
Agreed. This is the primary reason my personal browser's been Opera for the last 7+ years.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|