winforms

How should I be using IoC in this winform piece of code?

Hi folks, I've got a winform app in visual studio 2010. My app does the following Get a list of files which I need to read the data then insert into a database. For each file, read data and insert into DB. So .. this is the code i have. // ******* // *** How should the _repository be Injected?? // ******* var list = _repository.Get...

If Html File Has No Ending "/tr" Tag OR "/td" Tag Then HTML Agility Pack Does Not Read That Information Perfectly.

I am using HTML Agility Pack to parse html content. I am using parsing to extract table information. It works. But if there is no ending "/tr" tag or "/td" tag then it does not parse that information perfectly.(in which there is no ending tr tag or td tag.) Like <html> <head> <meta name="generator" content= "HTML Tidy for...

Can Windows Controls works with WPF?

We have Win Forms application uses the 3rd party windows native controls. Can these controls used with WPF application? ...

Show NotifyIcon Context Menu and Control Its Position?

I'm trying to show a context menu when I left-click a NotifyIcon. Just calling NotifyIcon.ContextMenuStrip.Show() doesn't work very well. A solution has been posted here before that calls a secret method using Reflection: Dim mi As System.Reflection.MethodInfo = GetType(NotifyIcon).GetMethod("ShowContextMenu", Reflection.BindingFlags.In...

Find the x, y point of a string within a text box

Is there a way to return a point for a string within a text box? I found a COM function GetTextExtentPoint that will return the length of a string, but I want to know the point where the string starts. ...

Bind different entries to DataGridViewComboBoxCell from a data source

I have the following data I want to display in a DataGridView: DataEntry[] data = new[]{ new DataEntry(){Name = "A", Entries = new []{ "1", "2"}}, new DataEntry(){Name = "B", Entries = new []{ "1", "2", "3"}}}; "Name" will be a simple TextBox field, and "Entries" a ComboBox where the items to choose from are the elemen...

Need better information on how to use VS2008 Setup Project to deploy a .NET Win App

MSDN is a nice place to get vague, general information on this, with just a enough detail to make you wish you had more. The best info on MSDN I found was in the section on Windows Home Server (oddly enough), but it wasn't complete enough to be totally useful. Is there another source with some DETAIL on how to create an MSI using a VS2...

Visual marker when moving rows on DataGridView

Users drag rows up and down in my DataGridView. I have the dragging logic down-pat, but I'd like there to be a dark marker indicating where the row will be placed after I let go of the mouse. Example from Microsoft Access; I want to drag rows instead of columns Does anyone know how I'd go about doing this? Is this built-in, or would...

How to access the Desktop Composition Engine from a WinForms app?

Is it possible to access the Desktop Composition Engine in Windows Vista from a winforms application? The DCE apparently involves applications rendering to DCE buffers instead of directly to the screen. Since a winforms app has no way of getting information about the monitor's refresh rate and scanline status (other than via DirectX), ...

Treeview OnClick chages images

Hello guys, I have a treeview (winforms) which have different item types on it. I have three item types on it, and when a user clicks on it, it changes the icon of that clicked item to the first ImageList image. I don't that to happen (altought i know it's desired behavior for default treeview). Any chance I can do this? How? Thanks ...

Sorting Winforms TreeView in a type safe way?

Is it possible to sort a TreeView collection using IComparer<T> and not IComparer? After all they are all TreeNode values, right? ...

Determine how an application is closed

I am trying to determine if my application is closed through clicking the "X" on the windows form, or if they clicked an "Exit" button I have on it. Right now I am using StackTrace.GetFrame(someIndex) to determine how, but i am looking for a more definitive way since it looks like these frame orders arent guaranteed. Is there a better ...

Best aproach for working with Time in WinForms?

I'm trying to make a field where user will enter amount of time per day he/she spent on a project per day. It can be from 30 minutes to 8 hours. Is DateTimePicker with CustomFormat hh:mm best choice for this? Or there's better alternative for WinForms C#? Maybe TextBox or MaskedTextBox with special settings? ...

Customising the .NET PrintPreviewDialog?

Currently i'm using the PrintPreviewDialog to open a window to preview the printed pages before they are sent to a printer. The problem is though that it first appears very small, at the top left of the screen and the buttons are too small. Is there anyway i can set a starting size for this dialog or start position or even make the li...

Good patterns for building a wizard?

I usually use a TabControl and somehow hide the tabs and navigate through them. I am curious about other ways of doing this!!! ...

How can I draw a Rectangle on a PictureBox?

I am trying to just draw a Rectangle on a PictureBox that is on a Form. Writing text like shown here works fine. private void pictureBox1_Paint(object sender, PaintEventArgs e) { using (Font myFont = new Font("Arial", 14)) { e.Graphics.DrawString("Hello .NET Guide!", myFont, Brushes.Green, new Point(2, 2)); } } but when I try to ...

Remember values that user has typed into a combobox

Is there any built-in or easy way to add autocomplete and persistence to a combobox (like in a browser)? It would also be great if users could delete entries (also present in most browsers)? Basically, the user would type in a command, then type in another one and also be able to use the dropdown (or Suggest/SuggestAppend) to grab an...

Errorprovider shows error on using windows close button(X)

Hi guys, Is there any way to turn the damned error provider off when i try to close the form using the windows close button(X). It fires the validation and the user has to fill all the fields before he can close the form..this will be a usability issue because many tend to close the form using the (X) button. i have placed a button for...

How to edit cell of type Linkcolumn in a gridview

I have a gridview control having 4 columns. one of the column is of type linkcolumn. user has to enters data for each column. How can we edit link column cell. if i click on this cell nothing happen.i set its readonly to false also. ...

Inserting Ending Tags For Missing Tags In html.

How to insert the ending html tags where there are missing ending tags ? Like <tr> <td>Index No.</td><td>Name</td> <tr> <td>1</td><td>Harikrishna</td> Where two missing ending tags.That is "/tr".Now in this case how to Search where are the missing tag and there how to insert appropriate ending tag such as "/tr". ...