473,799 Members | 3,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cursor Disappears in DataGrid cell, vb.net 1.1

1 New Member
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 UpgradeGridColu mns()
Dim colText As String
Dim currColumn As DataColumn
Dim currColStyle As DataGridTextBox Column
Dim ColumnStyle As DataGridTextBox Column
Dim ds As DataSet
Dim Graphics As Graphics = lookupMapGrid.C reateGraphics()
Dim DataTable As DataTable

ds = mLookupMapOutpu tRule.Mappings. DataSet
DataTable = ds.Tables(0)
currColumn = DataTable.Colum ns.Item(lookupM apGrid.CurrentC ell.ColumnNumbe r)

For Each ColumnStyle In mTableStyle.Gri dColumnStyles

If (Not IsDBNull(currCo lumn.ColumnName )) AndAlso ColumnStyle.Map pingName.Equals (currColumn.Col umnName) Then
colText = ColumnStyle.Tex tBox.Text.ToStr ing()
If colText Is Nothing Then Exit Sub
If (Graphics.Measu reString(colTex t, lookupMapGrid.F ont).Width > ColumnStyle.Wid th) 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.Tex tBox.SelectionS tart
If insertionPoint < 0 Then Exit Sub
ColumnStyle.Wid th = CType(Graphics. MeasureString(c olText, lookupMapGrid.F ont).Width, Integer) + 5

' after width change, the whole text gets selected and we dont want that
ColumnStyle.Tex tBox.SelectionS tart = insertionPoint
ColumnStyle.Tex tBox.SelectionL ength = 0
ColumnStyle.Tex tBox.Focus()
ColumnStyle.Tex tBox.Cursor.Sho w()
ColumnStyle.Tex tBox.ScrollToCa ret()

End If

End If
Next

End Sub


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

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

Similar topics

1
1762
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 don't want the cursor show up nor the cell get focused. It's like MS Outlook's email address lookup screen. When you click a row, the whole row get focused and there is no cursor. Is that possible? Please help. Thanks in advantage. Li
0
1487
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 this other dialog if i click into the same cell because the cursor is into this cell an if i click into this cell the event startet note once again. My event is: -------------
4
1782
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 anyone see what is wrong here? protected void Grid_ItemCommand (Object sender, DataGridCommandEventArgs e) { if ( e.CommandName == "Details" ) {
2
3763
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 that) but what's about row num?
0
1037
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 type- but your typing will be invisible until you go to another cell. Has anyone else seen this strange behavior or do you think I'm doing something wrong? Thanks.
1
2819
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 itself because those events do not use the MouseEventArgs, so I can't get the X Y position to determine if the cursor should change for that column
4
7376
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 close the form via a button on the toolbar (with going to another cell in the datagrid)I want to be able to popup a messagebox to the user asking them if they want to keep their changes. At the momment I'm accomplishing this by a property that...
1
2471
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 comboboxes auto drop down when they receive focus. Here's the problem: When you start typing in the text box the cursor disappears (this appears to be standard windows behavior). When you hit tab and the first combo box receives focus the cursor will...
0
1742
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 inside a specific cell. This is starting to appear impossible to do but I'm not convinced yet. The end goal is when a new row is added, the cursor is placed inside cell 0,0. Please help! Thanks in advance.
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9543
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10488
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.