winforms

Datagridview causing IndexOutOfRangeException when clicked upon

I have a datagridview which we will call dataGridViewExample. My object (the uncommon datatypes is because my database is SQLite): class MyObject { public Int64 Vnr { get; set; } public string Name { get; set; } public Single Price { get; set; } public int Amount { get; set; } } Here is the relevant code: //This form...

How can I get form1 to refresh when I close form2

I am looking to refresh form1 when form 2 is closed. I know to use a Closing Event from form2, but thats where I get lost. Thanks ...

Disable Multi-Select CheckBox functionality in a ListView?

I'd like to disable the multi-select feature of a checkbox in a ListView. How do I do that? ...

Different styles for Windows forms in Ironpython

Hi, I want to change the look of my Ironpython windows forms, Is it possible to change the style of the form and for example make it more like a Mac? thank you ...

How to make a control "transparent" for the mouse or Route MouseMove event to parent?

I want to create a card playing game. I the use mousemove event to drag cards through the window. The problem is if I move the mouse over another card, it is stuck because the card underneath the mouse cursor gets the mouse events, so that the MouseMove event of the window isn't fired. This is what I do: private void RommeeGUI_MouseMo...

Vista-alike WinForms control with a tight color bar on the left and icon and text more to the right

Is there any opensource implementation of a winforms control like the one on Windows Update window where "No important updates available" or another status is displayed? It looks like a bordered bar wih a tight vertical color bar - green or red depending on the information displayed, a large icon and several lines of text more to the rig...

Triggering a checkbox value changed event in DataGridView C#.NET

Hi I have a grid view that has a check box cloumn, and I want to trigger a drawing even as soon as the value of the cell is toggled. I tried the ValueChaged and the CellEndEdit and BeginEdit, and chose the selection mode as CellSelect. As for the The first 2 events, the event was triggered upon the finishing of the edit mode, like movin...

How to render a gradient in memory using GDI(+)

Hi, I am trying to render an Image object in memory with the dimensions 1x16. This image is used as a tiled background. The gradient itself should have 3 colors in a non-linear fashion. Pixel 1 to 6: Gradient Color 1 to Color 2 Pixel 7 to 16: Gradient Color 3 to Color 4 ...

MainForm.Refresh(); doesn't do what I thought it would do

I have a Form that gets the name of one of its Labels from a text file. This works fine when starting the app. But from another Form that text file changes and I would like that Label to change accordingly. This refresh takes place when the Form that made those text files changes took place closes. I thought Refreshing it would do the sa...

Problem changing values in textbox

Simplifying I have a text box and a button The button just create an messagebox with the text from the textbox. But i change the value of the textbox, the new value apears (Ex: Type 123) but the message box does not show the value. If i try to use the value in the programming (get the value by textbox1.text) the variable has nothing ( t...

How to neatly align text in a textbox and keep it when exporting to .txt

Hi, I am having a small stupid issue and I was hoping you guys could join in with your experience. I need a textbox with the following (dynamic) data: TEXT TEXT TEXT TEXT _______________________ Name: Amount: Blah 3 Blahblah 10 _______________________ But the text inside the box is the issue. S...

How do I get MessageBox button caption?

Hello, I'm making a custom message box that lets you copy text, but I wanted it to look exactly like a standard message box, so I would like to set the buttons text to whatever the system language is, as the MessageBox class does. Does anyone knows how to get that text ("Yes", "No", "Cancel", etc)?. ...

C# Form Move Stopped Event

Is there any event in C# that fires when the form STOPS being moved. Not while its moving. If there is no event for it, is there a way of doing it with WndProc? ...

WinForm disposing a sub form when the form is disposed

I have a form that can open a sub form (with ShowDialog). I want to make sure that the sub form is being disposed properly when the main form is done. I tried adding the subform to the components member of the main form, but at the moment I got a ArgumentNullException. I know I can just instantiate the components myself, but isn't that a...

How to bind Enum from DataTable to win forms CheckedListBox

i have this scenario: [Flags] enum Colors : long ( red = 1, blue = 2, green = 4, yellow = 8, ) DataTable dt = new DataTable(); dt.Columns.Add("PersonName", typeof(string)); dt.Columns.Add("CheckOption", typeof(bool)); dt.Columns.Add("Colors", typeof(long)); // note that the values in the Colors column are enumed values...

ListBox select all items

Hi, I need to select all items in a listbox when a checkbox is clicked. Is it possible to select all items in the listbox using a single line of code? Or will I have to loop through all items and set selected to true for each one of them? Thanks :) ...

Unable to change the gridview column width programatically

Hi, On my windows form, I need to programatically set the width of columns in the grid view. I am using the following code: this.dgridv.Columns[columnName].Width = columnWidth; The above stmt runs without any error. But, the column width remains unchanged. If I insert a breakpoint and check the value of width after the stmt runs, it i...

Embedding an Excel pivot table into C# winforms

Hi, Does anyone know how I can embed an Excel Pivot table control in a win form application developed in C#? The raw data for the form would be coming from a SQL Server 2000 database and loaded into a DataTable. Thanks, ...

Change OS info, Change resolution Info, IE Webbrowser Control .NET C#

Hi, I recently created an auto browser windows form app that browsers various places just for fun at this point. But I noticed when going to tracemyip.org that information related to my operation system and resolution are available to them. Is there any way to change only the appearance of my resolution and OS when browsing to these type...

WinForms TreeView - "Selected Node" indicator

What is the best way to leave some indicator of which TreeNode is selected in a TreeView on a WinForm? ...