473,320 Members | 1,948 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,320 software developers and data experts.

Listview BeginEdit and mouseclicks

This is driving me crazy. I have a listview that has LabelEdit set to true.
In the AfterLabelEdit event, I do my validation on the label text. If the
label isn't valid, it sets e.canceledit = true and calls the BeginEdit event.
I have included below the entire event handler code again as shown at the
end of this post.

Assume for this scenario that the label edited to an invalid value

After editing the value, if the user tabs away from the label, the code
executes as expected showing the messagebox and retruning to the label in
edit mode.

If the user edits the label and clicks away from the label, the validation
executes and presents the messagebox but after dismissing the messagebox, the
label will not automatically go back into edit mode (although it does have a
focus rectangle).

I have walked through the code and the sequence of events are the same
reguardless of how the users moves away from the label being edited. The
mouse click away from the label seems to be the culprit but for the life of
me I can't find a way around it.

Anyone have any insight into this?

Thanks

Private Sub ListView1_AfterLabelEdit(ByVal sender As Object, _
ByVal e As System.Windows.Forms.LabelEditEventArgs) _
Handles ListView1.AfterLabelEdit

Dim oIssueResponse As clsIssueResponse
Dim sName As String
Dim sPrompt As String

Dim i16ID As Int16

'Is the lable edited?
If e.Label Is Nothing Then
'There is No edit on the label,
Exit Sub
Else
'There Is edit on the label,
' take the label
sName = e.Label
End If

i16ID = CType(ListView1.FocusedItem.Tag, Int16)

'Validation
For Each oIssueResponse In mcolIssueResponses
If oIssueResponse.Name = sName And oIssueResponse.ID <> i16ID Then

sPrompt = "Cannot rename Issue Response: " & _
"An Issue Response with the name you specified already
exists. " & _
"Please specify a new name."

MsgBox(sPrompt, MsgBoxStyle.Exclamation, _
"Error renaming Issue Response")

e.CancelEdit() = True
ListView1.FocusedItem.BeginEdit()

Exit Sub

End If

Next oIssueResponse

Call UpdateIssueResponse(i16ID, sName)

End Sub

Dec 21 '05 #1
0 2587

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael C | last post by:
In a ListView control with LabelEdit set to true, you have to click and hold the mouse button longer than I would like to actually edit the label. Is there a way to make it so that you can click...
2
by: Bob Rock | last post by:
Hello, how can I create a ListView that allows to user to edit its columns contents? Thx. Bob Rock
1
by: Pep | last post by:
Hi, I'm using a ListView control in an app I'm developing... When a user clicks the New button in my form I add a new ListViewItem and call the BeginEdit() function on this item. My problem...
13
by: CJ Taylor | last post by:
Alright on a DataRow you have the BeginEdit method Where can I catch an event that tells me that method is being fired or does one exist? Thanks, -CJ
4
by: Won Lee | last post by:
Hello, I created a listview. I want the user to be able to edit the cells of the listview. I have LableEdit set to true but I can't seem to be able to select and edit a sell. Activation is set...
2
by: Mark | last post by:
Hello, I want to do different actions when clicking then when doubleclicking on an item in the listview. With doubleclicking, clicking events is also fired. How can I avoid doing the 2? Use...
0
by: Per Rollvang | last post by:
Hi All! I have a listview in virtualmode. I can't get the checkboxes to work right. The check-events don't fire, and the checked state seem to live a life way beyond my knowledge... Do I have...
2
by: bz | last post by:
Hi, How to start to edit listview items programatically? I know how to let users edit it by using LabelEdit prop, but I want to start this from a button or context menu too Thanks
1
by: NvrBst | last post by:
ListView is in Detailed Mode, and an Item is in EditMode (ListViewItem.BeginEdit()), how, if any, would I get the currently highlighted portion of the text? Basically I have a ctrl-c shortcut...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.