winforms

Cannot programmatically change tab pages once exception is thrown from SelectedIndexChanged event on TabControl

This is a C#, Winform question. I have a TabControl control and I use two navigation buttons to switch among my tab pages. I used TabControl.SelectedIndex = i to change the showing tab pages in the buttons' click event. Every time a specific tab page is going to be shown, one of several functions is called to prepare some background wor...

Print Barcode label in Alternative side in C# winforms

i print the barcode.but it doesnot print the alternative label.. if any idea Thanks Advance.. ...

color of row divider in datagridview

Hi I have a winforms (c#) datagridview form where I can set the divider between rows with row.DividerHeight = 1 But I would like to change the color of the dividerline, to lets say Color.Red, how would I do that? I dont want to change the background color of the cell. ...

How do I use the service locator implementation in System.ComponentModel for dependency injection in a WinForms application?

I'm trying to allow my business logic components to query for services when they are added to one of my form/control classes. For example, I might have a ClientManager class in my library, which encapsulates some business logic. It requires an ILoginManager instance to query for some data that it needs to operate. The concrete ILoginMan...

C# WebClient Log onto Website

Hello, I'm trying to log onto a website by providing my (correct) username and password. Here's the code: string URL = @"https://www.t-mobile.co.uk/service/your-account/login/"; string username = "a_user"; string password = "a_password"; //ServicePointManager.Expect100Continue = false; CookieAw...

How to pick semi-transparent colors during Design-time in VS?

After a quick subclassing of Windows.Forms.Label and then noticing that the default Label is able to use semi-transparent background colors just fine, I wonder whether there is actually a way to pick them in Visual Studio. The Color picker in the property Grid allows me to pick custom, Web and System colors but doesn't allow me to define...

Esc key in winforms works only with debugger

Hi is there any way to handle Esc key event in winforms? Actually it is working fine when i put debegger in the code. Once i remove the debugger it is not getting fired. Whats the problem here? Thank you ...

Hiding the PromptChar for .NET's MaskedTextBox

Is there a way to use MaskedTextBox without displaying the PromptChar? I would like to specify a mask to validate input against, but I don't want any prompt characters to take up space during edit mode. The reason for this is when I want to accept free text with a limited character set, all characters are optional alphanumerics. The pr...

.NET Projects: Where do I put .resx files?

Hello! Where do I put .resx files? Sometimes I see these files under Properties folder. Is there any design guideline about it? Thank you! ...

How do I create a banner panel in C#?

I want to create my own custom control that is basically a TableLayoutPanel with 3 rows and 1 column. The top and bottom rows will contain labels (banners) and the middle row is where I will add other controls. The problem is that when I try to build other forms/controls from this control, the designer doesn't recognize the middle pane...

Mouse enter/leave Form and Button child events problem.

have a program that fades out on mouse leave event. but the problem is when the mouse goes in to a child of the form like a Button, it triggers the mouse leave event. so i set up this code. private void Form1_MouseLeave(object sender, EventArgs e) { if (this.ClientRectangle.Contains(this.PointToClient(Cursor.Position))) { ...

Is there a better way of updating a data grid then just adding and removing the datasource?

I have a List collection where UserPropDef is a custom class with a few public properties. I want to display the contents of this list in a DataGrid. So I set the DataGrid.DataSource property of my grid to the list and it displays the contents just as I want. Now if I add or remove items from the list I want the DataGrid to update. I ca...

securing app.config - VB.Net 3.5

I'm using Visual Studio 2008 Pro to create a VB Winform App. I have some custom configuration settings as well as a MS SQL connection string in my app.config file. What is the best method to insure that no one can read these settings in the app.config? Are there any other area's that would have the connection string in plain text that...

C# Winforms Threading - Delay Child form event until form is closed

Hi everyone.. I have an interesting problem.. I have a Form that launches another Form (2) through a Button. Before Form2 Closes, it sometimes fires an Event which Invalidates Form 1 and forces Form 1 to refresh it's data. The problem I have is After Form 2 fires the event, Form 1 seems to get it and handles it, and refreshes it's data...

how to deploy an application automatically

In the office here we have a startup script that runs on the server which will update via copy/paste the software in house if there's a newer version on the server or not. This was simple, easy and fast to implement. There is now a problem, many of our users are off-site and they use laptops/tables which don't connect to the domain to r...

What is the "right" way to bring a Windows Forms Application to the foreground?

I am writing a Windows Forms Application in C#. I need to be able to bring it to the foreground. After some Googling and experimentation, I have a working solution that looks pretty hacky. I would like to know the elegant way to do this, if there is one. I need the app to restore and come to the foreground whether it was minimized, or n...

Move one form to another winforms - C#

Hi, I have 2 winforms Form 1 and Form 2. I have button1 in form1, when i click on button1 from form1 i display form2. Form2 ins = new Form2(); ins.MdiParent = this.MdiParent; this.Hide(); ins.ShowDialog(); I hide the form1 to display form2 when button1 is clicked. This creates a flickin...

What is a System.Windows.Forms.Design.ToolStripAdornerWindowService+ToolStripAdornerWindow?

I saw this come up in the Properties window after adding and then deleting a ContextMenuStrip. What is it and what does it do? Screenshot: ...

What are the minimum permissions a user needs to install and run a ClickOnce app based on .NET 3.5?

Googling reveals many technical details and framework/OS prerequisites, but it seems to be hard to find a source that lists the permissions that are required for installing and running a ClickOnce app. This is especially interesting for delivering software to customers that work in large corporate networks with many security restrictio...

how to add label on flowLayoutPanel1 at first index0?

how to add label on flowLayoutPanel1 at first index0? i would like to put label control in first or secound index how? that readonly? Label lb = new Label(); lb.AutoSize = true; lb.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(187)))), ((int)(((byte)(206)))), ((int)(((byte)(241))))); lb.Location = new System.Drawing.Point(122...