winforms

.Net Winform Apps with Portrait Monitor

I have noticed an undesirable behavior with .net winforms applications. I have a wide screen monitor rotated 90 degrees to the portrait orientation. When .net winforms applications display on it, the window appears, but it is all blank, white. I can fix the window by hitting ctrl-alt-delete and when the dialog comes up, hitting cancel, t...

Saving (Rich)TextBox's to memory and switching them off with a richtextbox in my form in C#

My goal is to have one main richtextbox in the form, and then several different richtextbox's in the backround, the backround textbox's get added, removed, and edited behind the scences all the time... and i need a way to swap my richtextbox in the form with the richtextbox's in the backround. what i origannally had was a Dictionary Di...

Better way of refreshing DataGridView.DataSource

Currently I have a DataGridView in my app which I fill from my Linq-to-SQL classes like so ... /// <summary> /// Delegate to update datagrid, fixes threading issue /// </summary> private void updateInfo() { // Linq to datagridview; display all var query = from n in dbh.Items select n; itemData...

DataGridView CellFormatting event preventing form painting

I am using C#, Winforms, and .Net 3.5 My form has a custom DataGridView (double-buffered to prevent flickering during my cellformatting events, as seen here). When I perform a database search, I bind the resulting dataset to the datagridview. I handle the CellFormatting event to paint rows a certain color, depending on their data. My ...

How to find the Form that hosts a particular a Winforms Control within the Control?

I want to be able to access whatever Form hosts my control within the code of my Control, so like: myControl.ParentForm Is this possible? If so, how? ...

Exception handling help

Hi All, I have written and tested a WinForms application and everything works fine on my machine (cliche, I know). When I created a setup project and installed it on a co-worker's machine, he receives the following message: ************** Exception Text ************** System.IndexOutOfRangeException: There is no row at position ...

Get a collection of all the DataRows coresponding to selected DataGridView rows

Is there a direct way to do this, or do I need to iterate over the DataGridView.SelectedRows, and then access DataGridViewRow.DataBoundItem for each row to create one? ...

Setting the form icon for an XNA window?

Is there any way of changing the icon for an XNA game form (i.e. the one that appears in the top left corner of the form, and on the taskbar)? I currently have a multi-icon with a variety of sizes embedded, including a 16x16 one. Unfortunately the project property "Application -> Resources -> Icon and manifest" uses the 32x32 one and sc...

C# - Avoid duplicating logic between WinForm and UserControl

Hi all, I found a question that I belive is what I was looking for, but there were certain things that I was not following in the answers. Therefore, I'd like to ask the question in a different way (Thanks for your patience). Here is the link I am referring to: http://stackoverflow.com/questions/259508/how-to-avoid-duplicating-logic-...

Help with storing/accessing user access roles C# Winforms

Hello, firstly I would like to thank you in advance for any assistance provided. I am new to software development and have designed several Client/Server applications over the last 12 months or so, I am currently working on a project that involves a user logging in to gain access to the application and I am looking at the most efficient ...

How to cast an object programmatically at runtime?

Suppose I have a custom control like: MyControl : Control if I have code like this: List<Control> list = new ... list.Add (myControl); RolloutAnimation anim = list[0]; I know I can do it at compile time but I wanna do it at runtime and access MyControl specific functionality. ...

Why isn't this If Statement executing?

Background I have a Windows Form with the following items ComboBox TextBox Two Buttons: Forward and Back A class - Items which holds a string int and double members if (ComboBox1.SelectedIndex == 2 && Items[index].Price > 50.00 ) { txtManu.Text = Items[index].Manu; txtPrice.Text = Convert.ToString(Items[index].Price); } ...

scroll using mousewheel inside panel with dynamically added picturebox controls

I've dynamically added 20 pictureboxes to a panel. i would like to see the panel scroll when I use the mousewheel. I set the autoscroll = true on panel control. Here is the code. For i As Integer = 1 To 20 Dim b As New PictureBox() b.Image = Nothing b.BorderStyle = BorderStyle.FixedSingle b.Text =...

C#: What is the proper way to swap winform controls?

What is the proper way to replace one winform element with another element when something is triggered? For example, I would like to replace a button with a text box in the same position and the same dimensions. ...

How can I use DataSets to store my application data in an XML file?

On my main window I have a DataGridView that I wish to display my data. My application allows users to input, change, and delete data. I asked my friend the best method of doing this he said storing the information in an XML file. So now I am wondering on HOW to use XmlSerializer. Can I make an XML document or DataSet and give it values,...

msiexec:How can I show the product name

I'm using msiexec.exe /x {GUID} to unistall my application, but it only shows "Are you sure you want to uninstall this product", how can I show the product name? ...

Knowing the point location of the caret in a Winforms TextBox?

I need to know the exact point location in my window where the caret currently resides so that I can pop up a small window under the text (similar to intellisense or a spellchecker). The issue is that GetPositionFromCharIndex doesn't seem to work on TextBoxes. This is what I'm trying to do: Point pt = mTextBox.GetPositionFromCharIndex...

How to make a Winforms application with remote sql

I have written a simple program(Winforms.NET), that selects a random word from a dictionary (DB table) everyday. When the DB is embedded its fine, but if I want to make the program take the data from a remote server. I suppose I have to put the ip address of SQL Server host into my connection string, but if host allows remote connectio...

Refresh / Update WPF controls like win forms

changing the text of a label (or sophisticatedly we can say a text-based progress bar). in winforms you just Invalidate / Update. But how to do this in WPF without using Background Threads. ??? ...

How to add a Panel to SplitContainer ?

I am using SplitContainer and it contains only 2 panels but I need 3(panels). QUESTIONS: Is it possible to add more panels to SplitContainer? if YES how? else why not? Thanks :-) ...