winforms

How to change the working directory while debugging in Visual Studio ?

I have a windows form project in Visual Studio that reads configuration files from an other project in the same solution. Once deployed this application will run from the root folder for the solution and the files will then be read from something like "/Project1/connection.config". When I however debug the forms application and get the ...

Is there other way to handle configuration data in Win Forms beside Custom Configuration Sections

I am in early beginning of learning and deploying Win App using C#, Now I wanna try to build sample application with sample store configure settings inside, I want to application remember the users selection of three or four folders with other specific information, as sharing name, and other two or three values for describing selected ...

can i control opaqueness of form with a trackbar?

this line of the code makes the form see-through "User32Wrappers.SetLayeredWindowAttributes(Me.Handle, 0, _ 255 * 0.4, User32Wrappers.LWA.Alpha)" if i adjust 0.4 to 0.6 it will become less see-through. i would like to know if i can control this variable through a trackbar and how! Public Class Form1 ...

usercontrol to connect to a SqlServer database

Hello, I've been writing some small maintenance/viewer tools that each connect to a SQLServer (2005) database via System.Data.SqlClient classes. (C# - .NET 3.5 - Windows.Forms) For each of these tools I had to write the UI and dialog to let the user choose the right db and server: I connect to my test-db, my colleague uses my tools to...

REGEX - Find td with specific class, including nested tables

Hi I've to parse over a piece of HTML. It looks a bit like: <table> <tr> <td class="blabla"> <table><tr><td><table><tr><td></td></tr></table></td></tr></table> </td> </tr> <tr> <td class="blabla"> <table><tr><td></td></tr></table> </td> </tr> </table> I need to extract each td with class blabla, but ea...

How to return first 50 characters of text in LINQ call

I have a small winapp that uses LinqToSQL as it's DAL. I am creating a summary view of all the CaseNotes for a given person and one of the fields is a Details box. I need to return only the first 50 characters of that column to my treeview function. Any hints on how I do that? The below is how my TreeView function gets its data for d...

Embed FontDialog in another WinForms Dialog

I would like to embed the FontDialog control into a settings dialog box for my C# WinForms application, but if I drag the control over it, of course, just adds it to the list of Dialog controls at the bottom of the designer. But instead of opening a separate dialog, I would like it to just be part of the settings dialog I already have.....

Simple way to bind radiobuttons to SQL table in C#

Hello, I'm trying to bind an SQL table to radiobuttons in a windows form application. The buttons are grouped by groupboxes. I haven't yet find a way to bind them correctly to the datasource. I know some had managed to do this by creating a custom control but I wonder if there is a simpler way? ...

search for winforms datagridview

I'm looking to implement a search box for a datagridview control similar to let's say firefox Control-F which would bring up a search box and on finding a match the row would be highligted etc. Is there any similar functionality perhaps using Lucene.net or similar ? Note - this would be different than say DataTable.Search() as the # of...

Tips for developing on WinForms thinking on a future Web developing

We are developing/mantaining an enterprise application which for historical reasons and development speedup it was targered for WinForms. Now we are thinking that sooner or later (more sooner than later) that application will need to be Web based. Thinking on the "to-Web" movement. Which are the most important things we have to consid...

WinForms key press isn't working right

update: I've modified the code below to reveal some additional information regarding the key that was pressed. update #2: I've discovered the root cause of the issue: we have an HTML control (Gecko rendering engine) on our form. When that Gecko rendering engine navigates to some Flash control, suddenly ~2% of our key presses don't get t...

Preventing a DataGridView from selecting the first item

I have a WinForm DataGridView that when I populate it with data the first item is selected by default. I don't want this to occur as to when an item is selected an event fires and some code is executed. Solutions I have for this is to unhook-bind-rehook the event or have a flag that is changed the first time the event fires after a new...

How do I make a child control re-anchor to its parent Form when it has been cut off on a small resolution screen?

I have a Windows Form with a default size of 1100 x 400, and I have a DataGridView control on it anchored to Top, Left, Bottom, Right. Resizing the form on a screen with resolution higher than 1100 x 400 works fine, and the anchoring works well, resizing the DataGridView control as expected. When I launch the form on a screen with res...

Save the Swatches on a ColorDialog in a C# Windows Application

I have an application where the System.Windows.Forms.ColorDialog dialog box is used as a color picker. Is there anyway that I can either (1) save the swatches the user saves in the "Custom Colors" section of this dialog or (2) create a standard set of swatches that all users would see when they open the color picker? ...

Disposing dynamically created controls

I have a WinForms TabControl that I am dynamically adding TabPages to at runtime. Each TabPage contains a WebBrowser control. I also have the ability to remove the TabPages at runtime. Should I bother Dispose()ing the TabPage and/or WebBrowser controls? It seems to me I should at least Dispose() the WebBrowser control since it is a bit...

.NET alpha blend appears as solid colour

I created a form that overlays on top of another form in an alpha blended state. This works great on my laptop but I just transferred the program to a computer at work and the form is a solid colour. This is probably a completely obvious question but are there graphics card requirements or colour depth requirements for alpha blending, I ...

How can I hide the drop-down arrow of a DataGridViewComboBoxColumn like Visual Studio Properties window?

I have a DataGridView where one of the columns is a DataGridViewComboBoxColumn. When the grid is populated, that column looks different because of the drop-down arrow appearing on each cell in the column. I'd like to change this so that the drop-down arrow is hidden and only shows up when the row is actually highlighted or when the combo...

Fastest way to tell if SQL Server is available

I have a winform program that uses Merge Replication to keep a local SQL Express sync'd with a Central SQL Server on our network. Due to the nature of this app the sync process runs automatically on App open and close. The way I am doing it (below) seems quite time consuming. What would be a faster way? Thinking outside the box it...

Winforms client and SSL WCF forms authentication

I am writing a console application to make calls to a wcf service that is hosted in iis and uses FormsAuthentication over SSL in production but not so in dev if possible. I have the following link http://www.zamd.net/2009/03/05/FlowingFormsAuthenticationCookieToWCF.aspx and am looking for both the server and client configs as well as th...

Detect Combination Key Event

I would like to perform key event detection in textbox. The key should combination of Ctrl+K, is there any best way to do it? ...