winforms

WinForms - VB.NET - Passing same list as DataSource for two different listboxes create problems

Check out the simple code below : Public Class Form1 Private _items As List(Of String) = New List(Of String) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load _items.Add("Item1") _items.Add("Item2") _items.Add("Item3") ListBox1.DataSource = _it...

Event which occurs when form is focused.

I have two forms first is frmBase and second is frmBalloon.I alter the focus of both forms that first frmBase is shown then frmBalloon is shown(frmBase is not visible)and then again frmBase is shown.Now I have need of event that occurs first frmBase loads and then again when it shows after frmBalloon becomes not visible. So I have need ...

Binding List<T> to DataGridView

I tried to bind List<T> to DataGridView. Everything seemed to be ok before I implemented deleting rows: Companies.CompaniesList.RemoveAt(dataGridView1.SelectedRows[0].Index); dataGridView1.DataSource = Companies.CompaniesList; (Companies.Companies is List<Company> collection) What I've got is data error message (although row was delet...

C# DataGridView bit value (WinForms)

Hello, I want to ask if I can put the checkbox that is originated from a bit value, into state of "intermediate". Is is possible to convert any cell (bit value cells) into checkboxes? Thank you. ...

WebBrowser Keyboard Shortcuts

I have a WebBrowser control displaying some HTML. I want the user to be able to copy the entire document, but not do anything else. I've set the IsWebBrowserContextMenuEnabled and WebBrowserShortcutsEnabled properties to false, and I want to handle KeyUp and run some code when the user presses Ctrl+C. How can I do that? The WebBrowser ...

.net Resizing control won't work?

I have a couple of pictureboxes that need to be resized by aspect ratio when the window size changes. I assumed I can anchor the width, but set the height manually (i.e. anchor the left, right, and top edges; but not the bottom.) However, my control won't resize if I try changing the Size property. Why wouldn't that work? How can I resiz...

webservice upload and progress

Please help me with this one, I'm not sure what the correct, or best approach is. Basically I have a webservice which takes a byte stream, enabling a c# winform application to upload files to the webservice. What I need is for the winform to upload in the background one file at a time (using basic multithread, it tries to upload them a...

Web-Update class in WinForms application

I have build an C# Winforms application which will need regular updates and patches in the future. To ease the update process for the users of my app I'd like to build an web-update class that looks for an update on my site. What would be the most secure and reliable way to implement such a class, considering: The site is build in PHP...

SSO for Silverlight 3 and WinForms application

Hi, I need Single Sign On for two types of application: Silverlight 3 and Windows Forms. Do you have any advice about how I could implement this? Windows authentication is one possible solution. Any other? Thanks Best regards ...

How to Stop Window Error Sound When Typing 'Enter' or 'Esc'

I have a form with a single text box on it. No other controls. Whenever I type the 'Enter' key or the 'Esc' key, the form functions as I desire; but I hear that horrible Windows error sound. The code looks similar to the following... public class EntryForm: Form { public EntryForm() { } private void EntryTextBox_KeyUp(object se...

"A generic error occurred in GDI+" after loading a PictureBox with an animated GIF

I have a Windows Forms application in .NET 2.0 with a PictureBox on a form and I load it with an animated GIF by setting the PictureBox's ImageLocation property. When it is time for the animation to render the next frame, I get the following exception and stack trace: A generic error occurred in GDI+. at System.Drawing.Image.SelectAc...

C# - Highlight Current Line

Hello. I am new to C#, and I am creating a notepad type of application. It's working good, but I would like to highlight the current line - meaning the current line where the cursor is or where the mouse has been clicked on would be highlighted in another color. I haven't worked with colors in C# so far, so any help on this would be app...

Hosting a UserControl inside a custom DataGridViewCell

I created a custom DataGridViewCell to show a specific UserControl when the user starts editing the cell. Basically the control contains a TextBox with a suggestion list easily handled by the code. I got my code to resize the list correctly, and have it contain exactly what I want and where I want it. The problem I have now is that the c...

Combobox manual binding

Hi, I am trying to do something which I believe is not complicated but still - the straight forward approach doesnt seem to work... I created a user control and bound it to a datatable, then I created a new Binding and binded another object to that same combo (SelectedValue to be more exact) in the following manner: this.cboValue.Data...

Show progress till an operation completes winform

I have a WinForm app(.net 3.5) that when you first select a Person it retrieves all of that persons data for there entire Plan. This can take up to 5 secs. I need to show my users(in house only) that the program is loading/working in some way. I also need to keep them at that screen until it finishes as well. Do to the design of the ...

Windows forms--including windows w/in another window

I have an application with one main window. In the window, you click on a button that spawns other windows. I was wondering if anybody knew how to keep these spawned windows within the original window and not let it be able to be dragged out of it? ...

DataGridView: How to select an entire Column and deselect everything else?

I been trying to find out how to select all cells under a Column with a 'mouse right click+menu+Select this Column'... MSDN isn't helping much... I get this error when I try to change selection mode: DataGridView control's SelectionMode cannot be set to FullColumnSelect while it has a column with SortMode set to DataGridViewColumnSo...

how to read data from a web browser

i need to read data from a web browser and add some of this data to my database. data is in web browser table. ...

Is it possible to call Javascript method from c# winforms?

Hi, I've a JavaScript file and it contains some methods. I want to call those methods from my winform application. Is it possible? If so can you give me a simple example? I've tried like this Process.Start("javascript:showuser('User1');return false;"); But it is not recogniging the showuser method. Because my js file is in remote loca...

Programming a ComboBox that appends selected items to its textbox

This is a problem I've had to deal with in my last project, and although I found a working solution, I wasn't too happy with it and am wondering if there would've been a better, cleaner one. Problem: Basically, I needed to implement a ComboBox that inserts or appends an item (selected from the drop-down list) to the textbox instead of ...