Click here to Skip to main content
15,916,702 members
Home / Discussions / C#
   

C#

 
GeneralRe:again i pasted code kindly see Pin
chandtec3-Mar-05 17:11
chandtec3-Mar-05 17:11 
Generalits geeting pasted , so i wrote code Pin
chandtec3-Mar-05 17:17
chandtec3-Mar-05 17:17 
Generali wrote code for button . its not getting displayed on this form Pin
chandtec3-Mar-05 17:24
chandtec3-Mar-05 17:24 
GeneralRe: i wrote code for button . its not getting displayed on this form Pin
Yulianto.3-Mar-05 17:46
Yulianto.3-Mar-05 17:46 
GeneralEvents.... Pin
ABBASI_RA3-Mar-05 16:24
ABBASI_RA3-Mar-05 16:24 
GeneralRe: Events.... Pin
s211197923-Mar-05 22:31
s211197923-Mar-05 22:31 
GeneralRe: Events.... Pin
ABBASI_RA4-Mar-05 3:12
ABBASI_RA4-Mar-05 3:12 
GeneralTrying to Programmatically Modify DataSet-databound Control Pin
Newbie_T3-Mar-05 16:19
Newbie_T3-Mar-05 16:19 
I have created a Windows Forms app in which I have a custom numeric edit box that is bound to an item in a DataSet, and a TrackBar control that I want to mirror the value in the edit box (i.e. changes to the number in the edit box effect the TrackBar and changes to the TrackBar are reflected in the edit box). Unfortunately I can not bind the TrackBar to the same value as the edit box because the edit box can contain values between .01 and 1000 (and it is my understanding that the TrackBar can only handle integers). It seems straight forward enough to trap the Validated event of the edit box and update the location of the TrackBar accordingly (after applying scaling factor – i.e. multiplying by 100 so min value is 1 and max value is 100000, and converting to int). The problem that I am having comes from trying to adjust the bound edit box value programmatically in the Scroll event of the TrackBar. In order to get the functionality that I want I had to add the following code to the Scroll event handler:

private void ctrlPowerTrackBar_Scroll(object sender, System.EventArgs e)<br />
        {<br />
            // why do I need to call EndEdit once I change a value<br />
            // in any bound edit box before this will work again??<br />
            (this.cmMyCurrencyManager.Current as DataRowView).EndEdit();<br />
<br />
            this.dsMyDataSet.tblModelSettings[0].itemPower = this.ctrlMyNumericEdit.Value / 100.0;<br />
        }


Could some one explain to me why I must call EndEdit(). If I remove the call to EndEdit(), changes to the TrackBar update the edit box as I would expect – at least until I change a value in any of the edit boxes that are bound to the same DataSet as the edit box that I am trying to update programmatically. It appears that modifying the value of a bound edit box causes BeginEdit() to be called for that row, but I haven’t been able to find any documentation on when EndEdit should be called. I’m not sure that calling EndEdit is the correct thing to do - I just stumbled across it and it seems to work. (If it helps, I should also mention that I am only using the DataSet for the purpose of data binding and as a means of easily storing and recalling control values in presets – i.e. there is no underlying database that will be updated with the data in my DataSet, and there will never be more than one row in this DataSet)

Thanks for your help.
GeneralThread Pausing &amp; Timer Pin
Bob Bonser3-Mar-05 16:13
Bob Bonser3-Mar-05 16:13 
GeneralRe: Thread Pausing &amp; Timer Pin
Stefan Troschuetz3-Mar-05 21:34
Stefan Troschuetz3-Mar-05 21:34 
GeneralRe: Thread Pausing &amp; Timer Pin
James Poulose4-Mar-05 1:40
James Poulose4-Mar-05 1:40 
QuestionNetwork Broadcasting. How? Pin
Roman Rodov3-Mar-05 16:07
Roman Rodov3-Mar-05 16:07 
AnswerRe: Network Broadcasting. How? Pin
Sebastian Schneider3-Mar-05 22:38
Sebastian Schneider3-Mar-05 22:38 
AnswerRe: Network Broadcasting. How? Pin
leppie3-Mar-05 23:46
leppie3-Mar-05 23:46 
GeneralRelease unmanaged code memory by managed code Pin
ting6683-Mar-05 15:25
ting6683-Mar-05 15:25 
GeneralRe: Release unmanaged code memory by managed code Pin
Roman Rodov3-Mar-05 16:18
Roman Rodov3-Mar-05 16:18 
GeneralClient/Server COM+ Application Pin
Wender Oliveira3-Mar-05 14:56
Wender Oliveira3-Mar-05 14:56 
QuestionHow to know if a place holder is empty Pin
see073-Mar-05 13:11
see073-Mar-05 13:11 
AnswerRe: How to know if a place holder is empty Pin
Rob Graham3-Mar-05 15:28
Rob Graham3-Mar-05 15:28 
GeneralRe: How to know if a place holder is empty Pin
see074-Mar-05 9:28
see074-Mar-05 9:28 
Generalsorting datagrid with empty rows Pin
Mc Fetto3-Mar-05 9:32
Mc Fetto3-Mar-05 9:32 
GeneralSelection Color Pin
Radgar3-Mar-05 7:39
Radgar3-Mar-05 7:39 
GeneralCalculations on Dataset Urgent Please help Pin
nishant.gogia3-Mar-05 7:37
nishant.gogia3-Mar-05 7:37 
GeneralRe: Calculations on Dataset Urgent Please help Pin
Kodanda Pani3-Mar-05 16:17
Kodanda Pani3-Mar-05 16:17 
GeneralRe: Calculations on Dataset Urgent Please help Pin
nishant.gogia3-Mar-05 17:07
nishant.gogia3-Mar-05 17:07 

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.