winforms

How to show a hierarchy of browsable properties in designer?

I am writing a windows forms UserControl and want to show a tree of properties for it in the designer. I have seen some controls that do this. For one control example, the "Appearance" property is a node that opens up to a set of properties, and also contains an "Options" node that opens to show even more properties. So far all I can get...

i want to display text from textfile in text box . how can i do this .. in C#

i want to display text from textfile in text box . how can i do this .. in C# Actually i m making text to speech converter in C# .. SO i want to open text file and want show text of that file in my textbox .. here is my code private void button2_Click(object sender, EventArgs e) { OpenFileDialog O = new OpenFileDialo...

How to change Event properties & create new events in C# .NET

Hello, I'm using NotifyIcon (System tray icon) in my WinForms application. I also have a ContextMenuStrip assigned to it. When user right clicks on NotifyIcon this ContextMenuStrip pops up. These are the only events that NotifyIcon has. Click DoubleClick MouseClick MouseDoubleClick MouseDown MouseMove MouseUp Th...

On zooming, the horizontal scroll bar and label shift up more than they should

I have a form, where there is horizontal scroll bar and beneath it, a label at the bottom. I have applied a zoom utility here, that is whenever I press zoom once the label grows 1.1 times in size and so on. The horizontal scroll bar remains of the same size but its location changes according to the label as per zooming, that is it keeps ...

Display data's in grid

Hi am developing a Billing project(for one company) using C# windows application forms, In that am using DATAGRIDVIEW to display all the data's, But am trying to bind the values product wise that is given by user in the producttextbox with auto completion(that is if am giving A means it will display in the DATAGRID all the products that ...

How do I force the main GUI thread to update a listbox after it is updated from a different thread?

I'm tinkering away on a multithreaded downloader, using a producer/consumer queue construct; the downloading parts works fine, but I'm running into a problem keeping the GUI updated. For now I'm using a listbox control on the form to display status messages and updates on downloading progress, eventually I hope to replace that with prog...

Disposing 2nd Time Doesn't Dispose Form?

I use this method to close forms according to their Id, but if I open a form with Id 2, close it once, it works fine, but if I open a form again with Id 2, it doesn't close the form (the form just stays on the screen). I have no idea what is going on and desperately need help. Thanks! public void OutsideClose(long Id) { if (Invoke...

How to get the size of the displayed Text in a TextBox

I need your help again. I need a way to determine the size of displayed text in a multi-column TextBox to set the Scrollbars property to the correct value. Since it is some sort of enhanced MessageBox what I work on, the size of the MessageBox should be determined from the height and the width of the text sourced by strings with newlin...

ComboBox SelectedIndexChanged event: how to get the previously selected index?

I have a user control which has a ComboBox and a SelectedIndexChanged event handler. In the event handler, I need to be able to tell what was the previously selected index... can anyone point me in the right direction? private void cboTargetMode_SelectedIndexChanged(object sender, EventArgs e) { // need to get the previously select...

Using a C# WinForms control in a C++/CLI (WinForms) application

How do I use a WinForms control written in C#, in a WinForms C++/CLI application ? If at all possible. ...

How can I "double-click, edit and save while-leaving" a Windows Forms DataGridView CurrentCell?

I'm barely new with WinForm's DataGridView control and quite honestly I'm having a hard time trying to mix and match its events and methods (e.g. CommitEdit() method didn't do what I've expected) to implement the simple concept of "entering edit mode by double-clicking the cell, modify its value (hopefully doing some sort of validation) ...

WPF/WinForms/GDI interop: converting a WriteableBitmap to a System.Drawing.Image?

How can I convert a WPF WriteableBitmap object to a System.Drawing.Image? My WPF client app sends bitmap data to a web service, and the web service needs to construct a System.Drawing.Image on that end. I know I can get the data of a WriteableBitmap, send the info over to the web service: // WPF side: WriteableBitmap bitmap = ...; in...

accessing files in a particular folder in a window application

I want to select multiple files based on their specific contents from a particular folder and edit their contents. I am using winform in C#. any idea which are the classes that can be used. It would be helpful if code given for example. thanks. ...

Curious about WinForm Control Thread Safety After Adding a Control on a Seperate Thread

I have a FileSystemWatcher set to pick up an picture that will be dropped in a particular directory. The way I was handling it was to add a PictureBox in code that is docked inside of a panel. I ran it, it blew up, and I realized that I was not handling the interaction with the controls on the main thread correctly. Here is the code: ...

in datagridview how to 2 column that will freeze ?

hi i have datagridview in my C# program and when i move scroll-bar to left, i want that the 2 right column will freeze and dont move. how to do it ? ...

Excel file parsing/scraping using .NET

Hi experts am trying to parse an excel file. its structure is very complex. The possible way i know are. Use Office introp libraries Use OLEDB provider and read excel file in a dataset. But the issue is of its complexity like some columns,cells or rows blank etc. What are the best possible ways to do this ? thanks in advance. ...

Call ShowDialog() without actually displaying the form

I need to call ShowDialog() on my Form without it actually displaying the dialog (keep Visible set to false). Unfortunately, there is no VisibleChanged event like there is on the full framework. I also can't override the the Visible property. The closest I can come up with is to override OnLoad and call Hide in a new thread (since the...

Show Form with PInvoke

Hi, I have below scenario: WinForms app which allow only one instance of this app to be run (Mutex is in use here to check). App on start with some paramatere is runnig but hidden. When somebody will click on app again then Mutex will detect that app is already running and "unhide" the main form by call of native method (see method Brin...

gotfocus() mdi child windows question (winforms)

I have a mdi and 3 child windows. The program start with an empty mdi. With a menu you can open each child window once. When i open for example 2 windows. And close the one on top. The one left(the window under the one i closed) should get focus. How can i manage this? why i need this? each childwindow has a event gotFocus. Depending ...

Logging to a text box with auto-follow cursor

I'm using a WinForms TextBox control for logging. It's been set as multiline with scrollbars. I'm inserting text by using: textBox.Text += logMessage; The scrollbar does not automatically follow with the latest log entry. Is there a way to do this? ...