winforms

Creating tabs in the Windows titlebar area in C#

Can someone tell me how to create tabs in the title bar area of a C# Winforms application? I'm looking for something similar to how Google Chrome looks. Each tab in Chrome is docked in the title bar of the main application window. ...

advice on debugging attempt to read or write protected memory exception with winforms

Some background, this application is a printing application that runs within REvit Structure, an Autodesk program. Its a .net add-in. I have been plagued with these sort of exceptions that pop up intermittently and it is really frustrating. How can I go about debugging these? Generally it is advised multi-threading is not used in Revit...

Invalid object name "CAccounts".

I keep getting this error: Invalid object name "CAccounts". and the code I have is: System.Threading.Thread thread = new System.Threading.Thread(() => { // Set ConnectionString. String sConSg = "CONNSTRING HERE"; using (SqlConnection connection = new SqlConnection(sConSg)) { try { c...

How to Pass Command Line Arguments to MSI Installer

Now my team working in a project using Windows Application(C#). We use MSI Installer for creating installation. I didn't know how to pass command line parameters from MSI file & Setup.exe file. for example setup.msi username=demo password=pass setup.exe username=demo password=pass Please suggest a good example/reference ...

Update a combo box automatically when first combo box gets some value

I have two combo boxes. I insert one value in first combo box and now i want that my second combo box updates its value according to first one. How should i do that? ...

How to make combo box accept value from keyboard

I have a combo box wherein i am feeding in items in drop down box. Apart from this i also want my combo box to accept the values i feed from my keyboard. When i write anything in the combo box then i get this exception message. InvalidArgument=Value of '-1' is not valid for 'index'. Parameter name: index It should display a list of item...

Multiple TableLayoutPanels for complex table

I'm trying to build a table layout similar to this --------------------------------------------------------------------- | 01.01.2010 01:00 | 01.01.2010 01:00 | 01.01.2010 01:00 | --------------------------------------------------------------------- | Some text | More | And | Final text | |...

How to code a new class within a win form

Is the a way in a win form app code in a new class with namespace and constructor?? ...

Closing dialog box and form which launched the dialog box

Hi, I have a form in a winforms app. When I press a button, it loads a modal message box with the options yes and no. This is fine, but when I press no, I want to close both the dialog box and the form where the button which launched the dialog box (the sender) is. So the app structure is like this: Main app window > press menu item ...

Windows Form Combobox fires SelectionChangeCommitted, SelectedValueChanged and SelectedIndexChanged event when application looses focus

...

Center columns in TableLayoutPanel

I want to create this TableLayoutPanel (C# in WinForms - programatically created at runtime!) --------------------------------------------------------------------- | 01.01.2010 01:00 | 01.01.2010 01:00 | 01.01.2010 01:00 | --------------------------------------------------------------------- | Some text | More ...

Auto-resizing textbox

Hi, I have a textbox which must be disabled on my page. However, the text in the textbox is larger than the size of the textbox. As the scrollbars for the textbar are therefore disabled, I need the textbox to automatically resize and therefore resize its parent form too. Is this possible? If so, how? ...

Grouping DataGridview in c# Winforms

Hi I have the following data in datagridview in c# winforms: Column A | Column B | Column C | Group Register 1 | 10,00 | 15,00 | Group 1 Register 2 | 10,00 | 15,00 | Group 1 Register 3 | 10,00 | 15,00 | Group 2 Register 4 | 10,00 | 15,00 | Group 2 ...

Linebreak in WinForms Textbox

I'm having some trouble dealing with linebreaks here. Basically, the user puts in some data to a textbox that is then saved directly to the database. When I display the data in my program, I only want to display the first line of the textbox, so I tried Regex newLine = new Regex("/[\r\n]+/"); String[] lines = newLine.Split(row[data.tex...

Why do some applications look poor when Large fonts are enabled in Windows 7

I've noticed that some applications (eg. Visual Studio 2008, Gallio Icarus 3.1) don't look that great (eg. fonts are blurry) when I run them on my laptop which has fonts set to 120%, whereas other applications seem to render fonts crisply. I have unchecked the 'Enable Windows XP style scaling' option in the 'Custom DPI Setting' dialog i...

Crystal Reports Selection Formula

Does anyone know how/if you can use a MIN() in selection formula for a Crystal Report? Im wanting to do this: Dim sql As String = "" Dim startDate As Date = CDate(_startDate.ToString(_dateFormat)) Dim endDate As Date = CDate(_endDate.ToString(_dateFormat)) sql = "min({" & tableName & "." & dateFieldName & "}) <= " & st...

Change ToolTip font

I need a tooltip with custom Font. I have the following code, and this works... but the tooltip size does not fit the text. Where is the error? Public Class KeolisTooltip Inherits ToolTip Sub New() MyBase.New() Me.OwnerDraw = True AddHandler Me.Draw, AddressOf OnDraw End Sub Private _Font As Font Public Prope...

Should I create new Pens/Brushes per Paint request or keep them throughout the application lifecycle?

I have an application that does a lot of drawing, let's pretend it's a Viso-like application. It has objects that have multiple sub-objects that are drawn, things can be connected, resized etc. Currently when I call paint on a particular sub-object or object, I do the following: using(var pen = new Pen(this.ForeColor)) { // Paint fo...

multiple realtime graphics forms in own threads, global 60fps limit?

I'm using XNA and creating a bunch of forms that roll their own 'game loop' to handle drawing and such. Each new form is opened on its own thread, with a subsequent Application.Run(form) to make the thread handle the messages for that form. When I started I noticed that despite me not implementing any kind of frame limiting timing, the...

Performance problems with displaying a WinForm dialog from WPF application.

I am currently developing a WPF application that will utilize existing WinForm dialogs. I'm experiencing a long lag between the time I call ShowDialog() on a WinForm to the time it is displayed. Even when reusing WinForm dialog objects the lag time is nearly as bad on the second hit. Meaning that the problem isn’t in the constructor. D...