textbox

How to enable a disabled textbox from mouse click vb.net

爱⌒轻易说出口 提交于 2019-12-14 02:34:36
问题 Simple how to enable a Textbox which is disabled by clicking on it? how is this done? my code doesn't work Private Sub Textbox1_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox1.MouseClick Textbox1.Enabled = True End Sub Can anyone help me out. Do I have to resort to tracking the mouse clicks and X,Y positions of textbox with timers etc.. no events are fired from clicking it? 回答1: You can use IMessageFilter to trap WM_LBUTTONDOWN messages and then check

Binding nested validation rules on nested User Controls

回眸只為那壹抹淺笑 提交于 2019-12-14 02:29:57
问题 This is my first question here on SO...I have been a ready for a long time and never needed to ask for help because I usually find what I need, but I am having a hard time with this one... I am working on a tools suite in WPF. I created a few User Controls as follow: LabelTextBox (Label on the left and TextBox on the right) LabelTextBoxToggle ( LabelTextBox on the left and Checkbox on the right) LabelTextBoxBrowseFile ( LabelTextBox on the left and Browse File Button on the right) I use

Textbox SelectionStart, SelectionEnd and Caret (Cursor) Position

江枫思渺然 提交于 2019-12-14 01:43:35
问题 This could be very simple. I have a textbox on a WinForm, Text = "ABCDEFGH". I need to select "BCD" and leave the I-Beam (cursor, caret, blinking '|') right between the 'A' and the 'B'. Setting SelectionStart = 1 and SelectionLenght = 3 doesn't work and I can't figure it out. 回答1: You need to set the SelectionLength to 0 as noted in the documentation. You can programmatically move the caret within the text box by setting the SelectionStart to the position within the text box where you want

How to neatly align text in a textbox and keep it when exporting to .txt

纵然是瞬间 提交于 2019-12-14 01:32:33
问题 I am having a small stupid issue and I was hoping you guys could join in with your experience. I need a textbox with the following (dynamic) data: TEXT TEXT TEXT TEXT _______________________ Name: Amount: Blah 3 Blahblah 10 _______________________ But the text inside the box is the issue. So far I am making all this text with a StringBuilder called SB and in the end I set MyTextBox.Text = SB.ToString() ; I set the header inside the box like this: SB.AppendLine("Name\t\Amount:"); I generate

Spelling with textboxes and custom dictionaries slowing down my application in C# WPF

偶尔善良 提交于 2019-12-14 00:19:44
问题 I am using a WPF TextBoxes inside my WinForm application for spell checking. Each time I create one, I load the same file in as a CustomDictionary. All has been fine until recently. Now, they take a long time to load, up to a second. Some forms have 30 or more, meaning delays of nearly half a minute. This seems to be the case Windows 10 (not Windows 8 as I originally posted). The application is running under DotNet 4.0, I have tried 4.5 and 4.6 (not 4.61) and all versions are slow. I have

updating using sql parameters in vb.net

一世执手 提交于 2019-12-13 21:37:04
问题 my code returns error saying violation of PRIMARY KEY constraint 'PK_tblOfficeEquipmentProfile'. Cannot insert duplicate key in object 'tblOfficeEquipmentProfile'. This is my code: Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click Dim sqlconn As New SqlClient.SqlConnection sqlconn.ConnectionString = "server = SKPI-APPS1;" & _ "Database = EOEMS;integrated security=true" Dim myCommand As SqlCommand 'parametrized update sql command

WPF customized TextBox

匆匆过客 提交于 2019-12-13 19:09:10
问题 I have a customized TextBox named "txtAddress" which contains Image and TextBox . I need to be able to access its contents : txtAddress.Text txtAddress.Image I've Bound the inner textBox.text with the Template.Text and inner rect.Fill with Template.Background (I'm using rectangular now, i will change it to image) when I run the program and edit the textBox everything looks like its working and the text is changing, but when i use it from the code txtAddress.Text is still "my computer" which

MVC 4 textbox not updating on postback

☆樱花仙子☆ 提交于 2019-12-13 18:31:07
问题 I have a form that uses a modelview object that is not updating a textbox value on postback of submitting a form. On submitting a form, I edit the property of an object that is binded to a textbox. When the form comes back, the object property is still changed, but the textbox value does not change. It's like the textbox value is cached and will not change. How do I fix this? Textbox default value: "" Textbox code: @Html.TextBoxFor(m => m.Project.tNumber, new { @readonly = "readonly", @class

C# Textbox Autocomplete: How to provide custom 'matching' function?

回眸只為那壹抹淺笑 提交于 2019-12-13 17:59:33
问题 I'm using C# TextBox with AutoComplete via a Custom Source of a collection of names, e.g. John Smith, Mary Jane, etc .. The problem is that if I type in 'John', I do see 'John Smith' in the dropdown. But if I start typing 'Smith', I no longer see 'John Smith' in the dropdown. I'd like to change this, and I think I would have to extend the TextBox class and provide my own function for matching data. I just don't know which TextBox function would need to be overwritten. Secondly, another

Validate the Date In Textbox

纵然是瞬间 提交于 2019-12-13 16:25:22
问题 How can I determine if the value in my textbox is a correct date ? ex: this is the value of the date in my Textbox: 01/32/2013 I know that it is a wrong value of date, but how can I determine that it is a wrong format? I can avoid that by using try and catch , but I don't want to use it, I will use it if I don't find a solution in my problem. <asp:TextBox ID="txtMEditStartDt" runat="server" Text='<%# Bind("StartDt", "{0:MM/dd/yyyy}") %>' CssClass="datePicker" SkinID="textSkin" Width="100px"><