Click here to Skip to main content
15,905,875 members
Home / Discussions / C#
   

C#

 
QuestionProblem with ByValue Parameters Pin
Seraphin19-Sep-05 8:24
Seraphin19-Sep-05 8:24 
AnswerRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:38
KaptinKrunch19-Sep-05 8:38 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 8:48
Seraphin19-Sep-05 8:48 
GeneralRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:53
KaptinKrunch19-Sep-05 8:53 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 9:10
Seraphin19-Sep-05 9:10 
GeneralBad solution - copy objects Pin
Seraphin19-Sep-05 9:19
Seraphin19-Sep-05 9:19 
GeneralRe: Bad solution - copy objects Pin
tommazzo19-Sep-05 10:36
tommazzo19-Sep-05 10:36 
QuestionC# reference parameter Pin
Csupor Jenő19-Sep-05 7:32
Csupor Jenő19-Sep-05 7:32 
AnswerRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 8:34
mveDave Kreskowiak19-Sep-05 8:34 
GeneralRe: C# reference parameter Pin
Csupor Jenő19-Sep-05 8:51
Csupor Jenő19-Sep-05 8:51 
GeneralRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 9:28
mveDave Kreskowiak19-Sep-05 9:28 
QuestionANDing, XOR 2 images Pin
DeepToot19-Sep-05 7:32
DeepToot19-Sep-05 7:32 
AnswerRe: ANDing, XOR 2 images Pin
Christian Graus19-Sep-05 11:40
protectorChristian Graus19-Sep-05 11:40 
QuestionAbout filealign compiler option Pin
Dario Solera19-Sep-05 7:12
Dario Solera19-Sep-05 7:12 
AnswerRe: About filealign compiler option Pin
leppie19-Sep-05 7:19
leppie19-Sep-05 7:19 
AnswerRe: About filealign compiler option Pin
Dave Kreskowiak19-Sep-05 8:05
mveDave Kreskowiak19-Sep-05 8:05 
GeneralRe: About filealign compiler option Pin
Dario Solera19-Sep-05 21:51
Dario Solera19-Sep-05 21:51 
Questioncalling a function in reflection Pin
Yoyosch19-Sep-05 6:21
Yoyosch19-Sep-05 6:21 
AnswerRe: calling a function in reflection Pin
leppie19-Sep-05 7:13
leppie19-Sep-05 7:13 
AnswerRe: calling a function in reflection Pin
Andy Moore19-Sep-05 7:28
Andy Moore19-Sep-05 7:28 
QuestionRe: calling a function in reflection Pin
Yoyosch20-Sep-05 6:41
Yoyosch20-Sep-05 6:41 
QuestionDataGrid values Pin
zaboboa19-Sep-05 6:05
zaboboa19-Sep-05 6:05 
QuestionTextbox visibility and data binding Pin
Wjousts19-Sep-05 6:01
Wjousts19-Sep-05 6:01 
I have a datatable containing a date field which I have databound to a textbox on a form (the textbox is read only). Sometimes the date field is null, so in those cases I want to have the textbox (and it's associated label) disappear completely. I tried intecepting the Binding.Format event to example the value from the data source and set the visibily of the textbox control like this (tbValidTo is the textbox, lblValid is just a label):

<br />
		private void tbValidTo_Format(object sender, ConvertEventArgs e)<br />
		{<br />
			if (e.Value == DBNull.Value)<br />
			{<br />
				if (tbValidTo.Visible)<br />
				{<br />
					tbValidTo.Visible = false;<br />
					lblValid.Visible = false;<br />
				}<br />
			}<br />
			else<br />
			{<br />
				if (!tbValidTo.Visible)<br />
				{<br />
					tbValidTo.Visible = true;<br />
					lblValid.Visible = true;<br />
				}<br />
				DateTime dt = DateTime.Parse(e.Value.ToString());<br />
				if (dt<DateTime.Now)<br />
				{<br />
					lblValid.ForeColor = Color.Red;<br />
				}<br />
				else<br />
				{<br />
					lblValid.ForeColor = SystemColors.WindowText;<br />
				}<br />
				e.Value = dt.ToString("MMMM d, yyyy");<br />
			}<br />
		}<br />


The problem is that this code is acting really weird. As you flick between records it sometimes fails to update the textbox and instead contains the old value. Sometimes it fails to reappear when flicking from a null date record to a record with a data. When I set a breakpoint at the begining of the event I can see that usually the event fires only once when you change records but sometimes it fires 3 times (it gets as far as setting the visibility and then suddenly refires) and other times it doesn't fire at all. Can anybody suggest what the problem here might be? I have another double field that also get's hidden and it works fine so long as the date field is disabled, otherwise it does the same thing. Other fields (that don't get hidden but do get formatted) behave just fine.
QuestionSorting Arraylists Twice Pin
jgallen2319-Sep-05 5:30
jgallen2319-Sep-05 5:30 
AnswerRe: Sorting Arraylists Twice Pin
Stefan Troschuetz19-Sep-05 7:50
Stefan Troschuetz19-Sep-05 7:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.