![]() |
|
Complete newb with C# - Printable Version +- Southperry.net (https://www.southperry.net) +-- Forum: Social (https://www.southperry.net/forumdisplay.php?fid=14) +--- Forum: Rubik's Cube (https://www.southperry.net/forumdisplay.php?fid=58) +--- Thread: Complete newb with C# (/showthread.php?tid=17746) |
Complete newb with C# - Fiel - 2009-10-18 I am creating a GUI with C#. I have a textbox, "ProductName", with ProductName.MaxLength set to 55 (this is for eBay). I want the user to be able to know how many characters they have left to work with. In essence I want this: a dynamic piece of text that shows "55 - len(ProductName)". I'm not very good with C# or XAML, so what do you guys recommend? How do I go about accomplishing this? Complete newb with C# - JoeTang - 2009-10-18 In the Designer Code: this.ProductName.TextChanged += new System.EventHandler(this.ProductName_TextChanged); Generally, you can automatically achieve this by double clicking the object in the GUI, and it will create the code for you in both the Designer and the Form. The form code should look like Code: private void ProductName_TextChanged(object sender, EventArgs e)Complete newb with C# - Spaz - 2009-10-18 JoeTang Wrote:In the Designer Code: Fiel mentioned XAML, so I assume he's using WPF and not WinForms. For WinForms, Joe's correct. I have no idea how to do it in WPF, I've never used WPF. Double-clicking the text box in the designer would be a good place to start though. Complete newb with C# - JoeTang - 2009-10-18 Code: private void ProductName_TextChanged(object sender, TextChangedEventArgs e)What compiler/editor are you using, Fiel? Complete newb with C# - Fiel - 2009-10-19 MSVC# 2008 Express. Is WinForms that much easier to use? I wouldn't know Complete newb with C# - JoeTang - 2009-10-19 Fiel Wrote:MSVC# 2008 Express. I don't know anything about WPF, like Spaz, except earlier when I checked how to do the above. I've just always used WinForms. |