473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cursor Disappears in DataGrid cell, vb.net 1.1

1
i am having a problem regarding the disappearance of the cursor in the DataGrid cell after i change the width of the column on runtime.here is a function which is being called in the Textchanged handler of the embedded Textbox of DataGrid Cell.

Private Sub UpgradeGridColumns()
Dim colText As String
Dim currColumn As DataColumn
Dim currColStyle As DataGridTextBoxColumn
Dim ColumnStyle As DataGridTextBoxColumn
Dim ds As DataSet
Dim Graphics As Graphics = lookupMapGrid.CreateGraphics()
Dim DataTable As DataTable

ds = mLookupMapOutputRule.Mappings.DataSet
DataTable = ds.Tables(0)
currColumn = DataTable.Columns.Item(lookupMapGrid.CurrentCell.C olumnNumber)

For Each ColumnStyle In mTableStyle.GridColumnStyles

If (Not IsDBNull(currColumn.ColumnName)) AndAlso ColumnStyle.MappingName.Equals(currColumn.ColumnNa me) Then
colText = ColumnStyle.TextBox.Text.ToString()
If colText Is Nothing Then Exit Sub
If (Graphics.MeasureString(colText, lookupMapGrid.Font).Width > ColumnStyle.Width) Then

' since the column width change causes the whole text to be selected and the
'insertion point(.TextBox.SelectionStart) sets to 0 so we want to save the insertion
'point
Dim insertionPoint As Integer = ColumnStyle.TextBox.SelectionStart
If insertionPoint < 0 Then Exit Sub
ColumnStyle.Width = CType(Graphics.MeasureString(colText, lookupMapGrid.Font).Width, Integer) + 5

' after width change, the whole text gets selected and we dont want that
ColumnStyle.TextBox.SelectionStart = insertionPoint
ColumnStyle.TextBox.SelectionLength = 0
ColumnStyle.TextBox.Focus()
ColumnStyle.TextBox.Cursor.Show()
ColumnStyle.TextBox.ScrollToCaret()

End If

End If
Next

End Sub


does anyone have any idea whats the problem or any workaround? thanks
Oct 6 '06 #1
0 2267

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Li Weng | last post by:
I set the DataGrid's readonly = true and its binding dataview's .AllowEdit = False. I can't edit the DataGrid. But I still can click a cell and put the cursor in it and get the cell focused. I...
0
by: Michael Schindler | last post by:
How i can eliminate a cursor from a datagrid cell? If I click into a datagrid cell then I open a other dialog with parameter key from this row. If I close this other dialogue a can not reopen...
4
by: Dave bailey | last post by:
When I execute the following code when using a dynamicall created LinkButton in a dynamically created dataGrid, the DataGrid disappears and the page I am trying to get to does not load. Can...
2
by: Alexander Nenashev | last post by:
hello. is there some optimal way to get datagrid cell (row, col num) from mouse cursor position? with col there seems to be no big problem - there's FirstVisibleCol property (something like...
0
by: Junkguy | last post by:
I have noticed in my form based DataGrids that the blinking caret in a cell will disappear when resizing the window if the DataGrid resizes with it. The caret will still be there and you can still...
1
by: MrNobody | last post by:
How can I customize DataGrid so that when the mouse hovers over certain columns the cursor changes to the Cursors.Hand cusror? I was unable to use the MouseEnter/MouseLeave events on DataGrid...
4
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to...
1
by: Jason J. Hedges | last post by:
I posted this in dotnet.framework.windowsforms and haven't received a reply. Hopefully someone here can help. I have a windows form (.Net 1.1) with a text box and some combo boxes on it. The...
0
by: chatelain | last post by:
I'm using vb.net's datagrid in a windows application. So far I have not found any successful code to select a specific cell, select the text inside a specific cell or simply place the flashing cursor...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.