I have what I consider to be a pretty unique problem here, and no idea how to implement. From what I've seen, there is no documentation, tutorials, samples and/or articles on this. I've spent weeks researching, with nothing to show.
The problem:
I need the user to be able to select the contents of a Label Control at runtime, and edit it.
If this can be done by extending the existing Label control, great! Or, if this requires a whole new Label Control to be created, fine. So be it.
Using a TextBox is not an option I'm afraid.
Any help at all is greatly appreciated!
Thank you,
jase
If it's just because a look & feel issue you can make a TextBox control look the same as a label would looks like (just guessing since I can't imagine any reason for not using a TextBox).
Could you pop up a window with a text box in it and then have them edit it there, then set the text property of the label based on the edited text box or do you need to edit it in place? You can set the label text at runtime, but for user input you will have to use a text box.
Related
I have a C# program that uses an Infragistics UltraWinGrid to display comments. A comment can be multiple lines. That is, it can contain carriage return/line feeds (CRLFs). (See the upper portion of the attached screenshot.) But when the user selects the text of the comment by clicking on the cell, it loses the CRLFs. (See lower portion.) This is a problem, because comments can be very long and the user may want to copy and paste a comment somewhere else without losing the formatting.
From what I understand, this problem results because the grid uses a Windows textbox as an editor when the user clicks on a cell. Is there some way that I can either make the textbox keep the CLRFs or replace the textbox with an editor that does? Thanks.
Turns out there are a few stars that need to align for this.
Of course CellMultiLine needs to be set for the column like wnvko pointed out.
But also, you must make sure your Column Style is NOT FormattedText or FormattedTextEdit. (If that's required for editing i think you are out of luck). Just use Default style.
And finally make sure you CRLFs are actually truly CRLFs. My best suggestion is to use Environment.NewLine. If you are pulling the data from the DB, make sure you use CHAR(13) + CHAR(10) in that specific order. See Differences Between vbLf, vbCrLf & vbCr Constants
Hope this helps 4 years later. :-) But wanted to share for others since i found no solution elsewhere.
My suggestion is to use Templates. Have a look at the official Infragistics UltraWebGrid help book that is explaining in depth how to configure features like Row and Column Templates.
Go to page 74 for more information regarding the templating.
You should set CellMultiLine of the column to True. Here is how it is working when I set it in my grid
I never found a real answer to this question, but I was able to do a workaround by capturing the click event and having it open a small dialog box containing the cell text. I had the dialog box open at the point the user clicked, so that it appeared over the cell. After a few minor adjustments to take care of border conditions, it worked surprisingly well, so I'm calling this one solved. Thanks, everyone, for your suggestions.
I need to change the Message Box Buttons Ok and Cancel Text to Update and AddNew?
Is it possible in C#.NET or I need to create a form and customize it?
Kindly help me in this.
The MessageBox class does not provide you with option to change the button text. This codeproject article, Localizing System MessageBox allows you do that by simply adding and using the class in your project
It is possible using a MessageBoxManager.dll, which you can get in the following link,
http://www.codeproject.com/Articles/18399/Localizing-System-MessageBox
You cannot change the text in MessageBox Buttons.To implement the scenario you can have your custom message box.Which can be build using User Control and show it as a Dialog whenever needed.
Changing the text of a button on a MessageBox is not possible by default. While the text might be changeable through fake localizations, this does not seem like a good way to do it from my point of view. I encourage creating a separate form.
I believe am in need of creating custom RichTextBox in C#. One kind of like that:
I admit it might not even have to be RichTextBox, but after some research I decided it's gonna be the easiest way. Functionality I need are icons at each row, checkboxes and text formatting. My program will process each line of the text and mark lines that are correct, incorrect, and strike out lines not necessary in further work, while showing line that's currently processed and allowing user to edit some lines freely (here: lines before Around 3 000 won't be editable, but those under the line will).
What's the problem then? I have no idea how to get it done. I've seen tutorial on how to make single-line textBox with icon or checkbox nearby, but I have no idea how to make both, and for multiline textBox (so I could freely scroll and everything would work fluently). I've read some questions on SO as well, but neither helped me.
I just don't know how to get started, I realize it won't be 5 min work, but I'm willing to do it. Until now I've been only able to create custom control deriving from RichTextBox, but I have no idea which methods and how to override. Any help appreciated.
Try to use WebBrowser control instead RichTextBox.
You can add CheckBoxes and editable content by setting a correct HTML code to it.
Set each TextBox or CheckBoxes ids and use GetElementsByTagName or GetElementById to access inner elements to get or set its attributes or values.
i was wondering if it is possible in c# to set to a text box a list of strings that are clickable links? at the moment i can set the text box like this
txtBox.Lines = values.ToArray();
ideally though i would like them as links if possible? maybe link labels or something?
(I'm assuming you're using Windows Forms; the answer for WPF/Silverlight may be slightly different.)
A textbox just contains text - it's not "rich" enough to have links.
If you want a list you might want to consider using a ListBox of some description - or possibly a RichTextBox; I haven't tried creating links in a RichTextBox, so I don't know whether it's possible.
Of course, you haven't specified what you want to happen when the user clicks on the links, either...
Use RichTextBox and check this - http://www.codeproject.com/KB/edit/RichTextBoxLinks.aspx
You can try using Windows.Forms.Controls.LinkLabel. It allows storing multiple links along with the text in it.
I have a form which has a Combo Box Control. I have selected the drop down style property to DropDown. I have also set the DropDown Width to 250.
I have set the auto complete mode to suggest and the auto complete source to listitems.
it works absolutely fine when i click on the drop down. but when i type in somethin, the auto complete mode activates a drop down which has a small width.
any help appreciate.
i wanna know how to increase the width of the auto complete drop down via code so that the list items are viewed properly.
I am using C#
Yes, this is by design. ComboBox uses the SHAutoComplete API function to implement the autocomplete feature. Note the declaration, the function takes a handle to the text box portion of the ComboBox. As such, it has no idea that it is actually providing autocomplete info for a ComboBox instead of a TextBox. Accordingly, there is nothing it can do to compensate for the non-standard dropdown width you use.
Well, that explains why it doesn't work. Fixing it is technically possible but quite ugly. You would have to run code in the KeyUp event and use EnumTheadWindows() to find the autocomplete window handle. Then you can use SetWindowPos() to make it larger. There is already code similar to this in ComboBox.cs (AutoCompleteDropDownFinder.FindDropDowns), use the Reference Source or Reflector to help you get this right. Good luck!
EDIT:
I removed my first suggestion to come up with a new link:
Actually its possible to control the width of the Autocomplete dropdown box, but its a little bit tricky and involves using win API extensively ...
Combobox too small when doing Suggest
Maybe this article that I wrote on Codeproject might help you in relation to the combo-dropdown boxes and a way that I hacked this...