winforms

How to get the size of a Winforms Form titlebar height?

So if it's toolwindow or a minimizable form, I want to be able to get its height programmatically. Is this possible? If so how? ...

C# Winforms Combobox with Label and Value

Hey guys / gals, I have a question that I am shocked I haven't had a need to ask before. I am mostly an ASP.net developer but I am trying to work on a WinForms app and noticed a large difference between the ASP.NET combobox (html select) and that of WinForms. I found (maybe incorrectly so) that WinForm's combobox only has a "label" wh...

ListView Item Added Event

Is there an event that I could use that occurs when an Item is added to a listView? ...

How to pass messages from a child user-control to the parent

This is a Windows Forms / .Net C# question. I have a borderless windows whose transparency key and background color make it completely transparent. Inside the window are a couple of user controls. I want to be able to move the window. I know how to do this on the parent window, but my problem is that the child controls are the only t...

Finding a control on a Winforms using Linq?

I am trying to find an elegant way to get controls on a Winforms by name. For example: MyForm.GetControl "MyTextBox" ... But this has to make sure it goes through all the controls recursively. What's the most elegant way to implement this using Linq? ...

Mapped Network drive couldn't access using WMI.

I have two machines, Say Machine1 and Machine2. I have mapped one shared folder in Machine2 in Machine1 as Z. I started one application say App1 which list all drives of machine and the application is in Machine1. I started this App1 from Machine1 and I got all my drives Including the mapped drive 'Z'. But when I Started the App1 which i...

Horizontal scroll bar appears even for 1 or 2 char length

I am using a table layout panel with autoscroll = true I found several issues which don't seem to work properly. One of them is that when I have more rows then in view and the vertical scroll bar is added along with the horizontal scroll bar. Actually this horizontal scroll bar should not appear until unless it exceeds the width of th...

location related to desktop

I have one toolstrip and I want to get its location related to desktop, what should I do ? I have tried Location.Y for its Y, but it gives 0 (zero) and that is related to form but I want y location related to its desktop. ...

Get a CloseReason when Application.Run() returns?

When a form is closed, it gets a useful argument in its FormClosed event, CloseReason. However our app runs with only a tray icon and no windows open most of the time. When it exits, I'd like to log the reason it exited - in particular, knowing CloseReason.WindowsShutDown and CloseReason.TaskManagerClosing would be useful. Is there any ...

How to show value printed by sql query in message box

I want to print a value that is returned by sql server. If NOT Exists(SELECT * FROM ItemList WHERE ItemName='txtItemNama') BEGIN INSERT INTO ItemList (ItemName) VALUES('txtItemNamea') END ELSE BEGIN Print 'Duplicate' END This query will either return me either no of rows effected or Duplicate I want to ...

Setting a Windows form to be bottommost

Some background One of my current clients runs a chain of Internet points where customers an access the net through PC:s set up as "kiosks" (a custom-built application "locks" the computer until a user has signed in, and the running account is heavily restricted through the Windows group policy). Currently, each computer is running Wind...

Is it possible to change a component name in a component designer in WinForms .Net

I've created a component whose name I'd like to be able to change while editing in the component tray. I've added a Designer action for a name property, but now I'm stuck. Looking at the property grid, I can see that the name property is parenthesised, indicating that it's not a regular property. Is this possible? ...

C# Why does the TextChanged event takes the previous width?

In my winforms application I have some code that needs to be executed after the text is changed. On the label I have a textchanged event with the following code: string value = lblText.Text; int labelWidth = lblText.Width; int controlWidth = groupPanel1.Width; int difference = controlWidth - labelWidth; lblText.Left = difference / 2; ...

How can I obtain a list of modified files within a 'changeset' range from team foundation server through a windows form application?

I'm trying to create a tool which will help my team perform code reviews on a more regular basis without it's usual massive overhead. At the moment the manual process involves using Team Foundation Sidekicks to identify the Changesets and then exporting that to excel to filter the results to find which items need to be reviewed (e.g. co...

C#: Set position of the arrow in a ToolTip Balloon?

Is it possible to change the location of the Arrow / Stem in a Balloon Tooltip? Reason to change is because of a Button, located in the top of the screen, should have a tooltip below it. Above is the situation right now, I only need the arrow to be on the top-left side of the balloon. ...

Find the upper left coordinate of a panel when scrolling

How to find the upper left coordinate of a panel when scrolling? (.net 2) Let's say an example in VB.NET that maintains a textBox in the left border of the custom the panel (myPanel.vb): Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) MyBase.OnPaint(e) TextBox1.Location = New Point(AutoScrollPo...

How to databind Enum value to a Boolean value?

So I have a main form with 3 controls whose Enable property I want to control using an enum. All these controls have a reference to the Data that contains the Enum value Level. enum Level { Red, Yellow, Green } So if it's Red, I want the RedControl to become enabled, if it's yellow, then YellowControl becomes enabled, etc...

How can I change Control's Opacity?

I want to change controls opacity depending on the mouse position on the form, is this possible? ...

Vertical Text on Right-Aligned TabControl

Trying to have the text on each tab of the tabcontrol to be displayed vertically. Being that I've never forayed into controls and what not, i'm sorta stuck. Found some code to get the text to display as if it were rotated to the left. I would like it to display as if it were rotated right (vertically) on the tab. The skeleton code is ...

DataGridView: How can I make the enter key add a new line instead of changing the current cell?

How can I make the Enter key behave in a Winforms DataGridViewTextBoxCell like it does in a normal Winforms TextBox (add a new line to the text, instead of changing the current cell)? ...