Kelly Martens
asked on
Convert vb6 Selection Code
In vb6 this will select the text of two textboxes.
Public Sub SelectEntireText(txt_box As TextBox)
txt_box.SelStart = 0
txt_box.SelLength = Len(txt_box.Text)
End Sub
In C# I need to do the same but with a datetimepicker control. (The text representation of the date). How could I do this?
Public Sub SelectEntireText(txt_box As TextBox)
txt_box.SelStart = 0
txt_box.SelLength = Len(txt_box.Text)
End Sub
In C# I need to do the same but with a datetimepicker control. (The text representation of the date). How could I do this?
Isn't there a .Select() method you can call on the DTP control?
I just tried and the .Select() method does not have the expected behavior.
This is surely because the DTP control has been overloaded to react to the up and down arrows to change the selected part (which is highlighted).
This is surely because the DTP control has been overloaded to react to the up and down arrows to change the selected part (which is highlighted).
ASKER
Right I found that too. I'm trying to mimic what the textboxes are doing because boss wants the same results for enduser
ASKER
Chinmay its just a visual effect of selection bias is after here
but doesn't really make sense because when you are working with a textbox you are working with only one of its parts at a single time.
Hi Kelly,
I think I can do some research in the area - but trust me - I do not have a good feeling about it. If that does not work out, are you Ok with a custom control?
PS: I love to do hac-n-slash solution, heck my entire career is built around those but this one :P... I don't think I would recommend you or anyone to go through it.
Regards,
Chinmay.
I think I can do some research in the area - but trust me - I do not have a good feeling about it. If that does not work out, are you Ok with a custom control?
PS: I love to do hac-n-slash solution, heck my entire career is built around those but this one :P... I don't think I would recommend you or anyone to go through it.
Regards,
Chinmay.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I am not sure if it is the same with DateTimePicker. I would like to know what exactly you are trying to do after selecting the text?
Please refer to: https://docs.microsoft.com
Regards,
Chinmay.