winforms

A panel switcher custom control for Winform in .net?

This is a .net winform UI question. In many cases, we want to design an UI such that, you have several options, and based on the option you choose, a different detail UI is setup for you. For example, imagine a user registration: based on the location you pick, you may be asked to fill in different information. Normally, when I design t...

How do you create an application shortcut (.lnk file) in C# with command line arguments

I've written a simple FTP based file synchronization program. The settings of which can be stored in an XML file. I want users to be able to quickly open the program using various configurations. So I set up the program to be able to read the path to a config file through command line argument. This way shortcuts can be created on the de...

Embed Image into own file

Hello, :) I have edited this question to make it easier to understand. I have an image file and I have to store the image data into an existing file in binary. And when that file gets opened in my program again, that binary data should be somehow read and that image displayed inside a picturebox. How would I go about doing this in C#? ...

How can I add a UIElement to a Windows Forms application?

I have a WPF custom control I'd like to add to a Windows Forms application. So I added a reference to the WPF assembly, created an ElementHost and set the Child property in code. Is there a way to do this with drag and drop i e without writing code? I have tried the ElementHost popup but it does not list my component. As far as I can see...

How to bind enum to winform combobox using objectdatasource

Hi all, i'm binding a class to a windows form using the object data source: binding simple properties to textboxes works fine, but i need to bind enum properties to comboboxes too, such as: public enum MyEnum { Val1, Val2, Val3 } private MyEnum enumVal; public MyEnum EnumVal { g...

How to refactor this method C# Window

I have a TextBox to search all occurences of the entered text in RichTextBox Control. The result will be populated in a listbox for traversal pupose after the search gets over. I have written following function to achieve thedesired result.. but its taking good amount of time to complete.. I need some suggestion to fix this issue In sh...

How to check CheckListBox item with single click?

I am coding Windows Forms application in C# and using CheckListBox Control. How to check CheckListBox item with just single click? ...

Is there any Visual Studio like code editor control?

I want to write an IDE in C# for my custom scripting language. Is there any code editor control with the IntelliSense popup, colors, etc for WPF/WinForms? Thanks. ...

ADO.NET & Oracle: Getting Line Number Info When Script Execution Fails

I've been working for some time on an application written entirely in C# that targets Oracle databases. The idea is to provide everything that Oracle SQL Developer does, but faster, with a smaller memory footprint. So far, I'd say I'm 90% there. But I've got one small problem, and it's annoying the $#@!$@ out of me! I'm using ADO.NET ...

How shoud I implement an application-wide color-code in a WinForm application ?

I'm building a WinForms application, and I'm using specific colors on most controls. I do that sometimes from the WinForms designer, and sometimes directly into my code. I got a static class somewhere looking like that : public static class MyColors { public static Color DarkGreen = Color.FromArgb(0, 70, 62); ... ...

RichTextBox links don't do anything

I have a RichTextBox control on a form with some text, some of which are URLs. The DetectUrls property is set to true. The control properly detects my URLs (they're blue, underlined and the cursor changes to a hand when I hover them). However, when I click on them nothing happens (double-click and ctrl+click are similarly ineffective)...

Determine largest font for given rectangle height (WinForms)

This is the inverse of Determine Label Size based upon amount of text and font size in Winforms/C#. Given a rectangle of fixed height but variable width, is there an efficient way to determine the largest size of a given font that will fit in the rectangle (height-wise) without risk of losing ascenders/descenders? I'm currently conside...

BackgroundWorker vs background Thread

I have a stylistic question about the choice of background thread implementation I should use on a windows form app. Currently I have a BackgroundWorker on a form that has an infinite (while(true)) loop. In this loop I use WaitHandle.WaitAny to keep the thread snoozing until something of interest happens. One of the event handles I wait ...

How to bind Dictionary to ListBox in winforms

It is possible to bind a dictionary to a listbox, keeping in sync between the listbox and the member property? ...

How to select the control with the lowest tabindex?

Given a control that has child controls. How do you give focus to the child control that has the lowest tabindex without looping through all the controls? ...

How do I click an ASP.NET webform's button when the page is hosted in a WebBrowser Control

I have a standard ASP.NET web form in a web page, and this page is hosted in a .NET Winform with a WebBrowser Control. Using c# how do I control the WebBrowser Control to submit the ASP.NET form? (eg somehow "clicking" on the button from the Winform?) Update: to complicate things we have the ASP.NET validators which seem to make simple ...

How to call windows form from native cpp

I have an existing project using c/c++ .NET. Currently I have been given a task to create a windows form from my existing code. So i have add new project windows form application in the existing c/c++ projects.form.h, form.cpp has been automatically created. Now I am having problem to call the window from my c files. Even i could not cal...

Reusing a Control in another Windows Forms Project

I've got lots of web experience but am a total novice when it comes to Windows Forms so this might be easy to answer: I have Project1 which I've added a reusable control to which allows filtering and searching of data and presenting results. I now want to use the same control in another Project. When I open Project1 and select my form...

Datagrid checkbox cell

I have developed a Windows Forms application and it has a datagrid with checkbox. If I press a button then I want to get all checked rows and do some operation on them. The problem is that when button is pressed it does not recognize the latest checkbox action. It is like one step behind. My code is: private void copyToToolStripMen...

Storing XML data withing winform application

I am creating a WinForm application in C# using VS2005, whihc receives an XML data, that needs to be displayd in the winform fields. What is the best way to store the XML data withing winform (either by caching or by creating some tabled dataset)? Also how to pass this stored data across various winforms withing the application? Please...