controls

DataGridView - how to set column width?

Hello fellows, I have a WinForms application with DataGridView control. My control has five columns (say "Name", "Address", "Phone" etc) I am not happy with default column width. I want to have more control over column appearance. What I want is to be able to do one of the following: Set width of each column in percent Set width of e...

WPF equivalent to ActiveControl?

In Forms, I can simple use ActiveControl.name to get the name of the active control. However in WPF this doesn't work. What is the WPF command equivalent to Activecontrol.name? I'll take C# or VB, either way. Thank you! ...

ASP: Extend control (ASCX) and access base markup file from subclass code

Hello, I'm building form validation controls for our C# ASP application. The bulk of the work is handled by a BaseValidator control (subclassing System.Web.UI.UserControl), which also has the markup for the validation output. This is then extended by subcontrols like PasswordValidator, that provides the Validate method and any extra fie...

VB.Net: Looping through all form items, including CommonDialogs

Hello everyone! I'm translating my VB.Net application, and I need to loop through all the controls on my form. Using a recursive function such as Public Sub TranslateControl(ByVal Ctrl As Control) For Each ChildCtrl As Control In Ctrl.Controls ChildCtrl.Text = Translate(ChildCtrl.Text) If TypeOf ChildCtrl Is Label...

.NET Referencing similar controls.

I have multiple toolstrip controls in my application and was looking for a way to hide them all at once. E.g. allToolStrips.Visible = false; instead of toolstrip1.Visible = false; toolstrip2.Visible = false; ... toolstripn.Visible = false; I'm using C# if it matters. ...

C#: Anchored Panel won't resize properly

Hi, I've a strange problem regarding auto sizing of a panel in a user control. This panel is anchored to all 4 sides of the user control. But the anchoring not always works as it should: If the user control is resized by resizing the form, the right and bottom anchors don't work. But if the control is resized by using a splitter which ...

Selecting and building a Control from a control library dynamically, using the control name from a table.

I have a custom DDL that lives in my Server control library. Currently I add this control to a table by strongly typing the name of the control, the customary way. Control_Library.Report_NumberDDL newDDL = new Control_Library.Report_NumberDDL(); What I want to be able to do is dynamically create that control by pulling the control ...

Instead of making an if() for each control type, is there a cast that will allow me to dynamically set the type of control?

I'm iterating through my controls on this web page and when a button is pressed to modify a piece of a data, I'm disabling the other controls on the page. Such controls consist of TextBoxes, ListBoxes, and Buttons. All of these controls have the Enable property so I was wondering if there was a way to just cast the control to some kind o...

Silverlight 3: How to support templating/styling of dynamically added controls?

I'm creating a reusable control that dynamically adds another templated control to its visual tree: DashboardContainer (top-level "container" control) - DashboardItem (control that is dynamically added to a StackPanel in container) DashboardContainer is already a templated control so its easy to copy/customize its template in Blend....

List of notices, which control is best choice?

I want to use a control to notice users what are happening and what've done. It's like a multiline textbox, each line contains a notice, such as: Connecting to database...done Current datetime: Inserting data into database 10/1000...done Inserting data into database 20/1000...done ... Inserted data into database Current datetime: I t...

Retaining viewstate in textboxes found in a dynamically created table

Hello Guys! My problem is that I have an ASPX page which contains an ASP:Table. The rows for the table is added dynamically on Page_Load. One column in the table contains TextBoxes, BUT when I type something on a TextBox and cause a postback, I am unable to find the value just entered. And above that the table is not displayed after the ...

Draw border around a Control on Button_Click

When a user clicks my Validate Button (in my C#, WinForm, .net 3.5 app) I would like to draw a border around a certain control if it is empty. Say a textbox that is named tbxLastName I thought I needed to do something like this --> ControlPaint.DrawBorder(Graphics.FromHwnd(this.Handle), tbxLastName.ClientRectangle, Color.Firebrick...

ControlPaint.DrawBorder().....but thicker!?!?

I have the below code, which works, to draw a border around a control in a WinForm 3.5 app. What I can't figure out is how to THICKEN the border that is being drawn. I tried Inflate(5,5) on the ClientRectangle but that actually made the Border disappear all together versus making it thicker. I get the impression that I actually need...

Clone Winform control

I have a groupox in a VB.NET winform app. The groupbox contains a few Labels, Textboxes and Checkboxes. This was created by simply dragging the controls out of VS toolbox. What I need to do is take the 1 Groupbox and at runtime create multiple Groupboxes to display based on user selection. Instead of dynamically creating the Groupboxes ...

How to prevent loading of data when postback fails validation

Hi, I'm trying to prevent data from loading on the page when its needed. Currently, I check the IsPostBack bool to prevent loading data in my user controls which allows the data to be loaded when the page is initially requested. However, if my page fails validation and the page is sent back to the user with error messages, my user con...

Resolve Rounding Errors while Resizing Controls on Winform

Hi, I have a requirement to resize all the controls on a form when my form resizes. Unfortunately, due to some issues I can not use any container control or make use of anchor/dock property. I need to do everything using code. I am able to resize the controls as per the ratio the screen is resized. While performing this resizing, I need ...

Loading controls from xml file

hi all, I know how to write to xml files, but I'm having trouble doing what I need to do and can't find adequate info on this type of problem. Here's one xml file below: <?xml version="1.0" encoding="utf-8"?> <controls> <Label Content="Double-click to edit." Location="258, 178" Size="101, 13" ForeColor="-1" /> <LinkLabel Con...

how do I add simple HTML to panel control which is part of a multiview control in asp.net

I have a multi view which contains a view which contains a panel. the name of this panel is "Panel1" I have the following code and my HTML does not display in the rendered page. Any idea why this isn't working, i must be doing something wrong? sw = simple html statement, any would produce same result. String mstring = sw.ToString(); ...

Ability to modify control dissapears when no properties are set

I'm adding controls programmatically to a canvas which is all just wonderful... var newControlPoint = new ControlPoint() { Width = 10, Height = 10 }; newControlPoint.SetResourceReference(Control.TemplateProperty, "ControlPoint"); SetCanvasPosition(newControlPoint, position.X - (newControlPoint.Width / 2), position.Y - (newControlPoint.H...

How can I include Flash in VB.NET?

I would like to create a .exe wrapper for a Flash Player using VB.NET. I am having a few problems. 1.I seem to remember being able to import Flash Player as a control into Visual Studio (2008 Pro). For some reason, I can't seem to VS to import it anymore. (I tried using the OCX from Visual Studio) Perhaps I'm looking for the wrong file....