DataGrid Text Disappears

karthick_kg

New member
Joined
Sep 5, 2004
Messages
1
Programming Experience
1-3
Hi,
I dont know how to explain my problems(2), but it has made my head bald

Problem 1:
I have a DataGrid, on the overridden keyPress Event I have called a Check() function,
but the problem is that the data returned is not the recent value but the older value, I do not know what is happening in between

Ex:
when i press "K" the text passed is ""
when i press "A" next the text passed is "K"
when i press "R" next the text passed is "KA"

Here is the Codings :

AddHandler dgColEvt.TextBox.KeyDown, New System.Windows.Forms.KeyEventHandler(AddressOf HandleKeyPress)
'dgColEvt is the DataGridTextBox Column that i have added to the Datagrid thru a ColumStyle

Private Sub HandleKeyPress(ByVal sender As Object, ByVal e As KeyEventArgs)
' MsgBox(e.KeyData)
BindCombo(sender, dgrCommon, True)
SelectName(sender.text, "prdname", "Product Name", "prdcode", "Product Code", "Product", dgrCommon)
End Sub

'I do not face this problem if i put that message box

Please, anyboby, if you know whats happening pls help me out with a solution.

Problem 2:

For the same DataGridTextBox, I have added an handler to handle Leave event

Private Sub HandleLeave(ByVal sender As Object, ByVal e As System.EventArgs)
'GetCode function gets the city code, sender is the DataGridTextBox and
'dgrCommon is another DataGrid where the data changes dynamically based onthe key Pressed

prdCode = GetCode(sender, dgrCommon)
'I get the prdCode properly
'But....In the next Line
'I get the name from the dgrCommon DataGrid and put it in cell from which the event has been called
msgbox(dgrCommon.CurrentRowIndex(), 0)
sender.Text = dgrCommon.Item(dgrCommon.CurrentRowIndex(), 0)

'The message box shows the value correctly. But the value in the cell doesn't change
'Here Too, the Value in the cell changes if i click some other cell using a mouse

Why is it so,Please help me out quickly. I have already wasted a week's time on this.

Thanking You.
 
Back
Top