winforms

access form to run query and display results

i have a query in ms access database how can i create a form that has a button to run the query and display the results in the same form ( the result is only 5 records of a two collumn table ) ( so that it looks more user friendly ) i dont need the complete solution by you .. just and advice on what code should be for the button and th...

How to setup feedback link on Windows Forms caption using C# ?

I would like to setup Feedback link on every windows form, so that user can send suggestion about design, functionality etc.. using C# (.NET 3.5) but I could not find solution. Any help or suggestion will be appreciated. ...

At what point in a Windows Form closing process do the Controls get invalidated?

I've recently set some coursework for some undergraduate students for which they have to use a small and relatively simple C# library provided to them. The main purpose of this library is to display a simple form which is composed of a coloured grid (which they can manipulate), a number of buttons and a label with some text. The class ...

Help with C# notepad project

I am making a multi-lingual (computer languages) notepad in WinForms. I have a menu strip with a toolstripmenuitem called "Languages" (Like the file, edit, view, ect.). When you click on "Languages", there are several checkable menu items. I want to do this: when an item is clicked, it appears checked; and when the user clicks it again, ...

How to prevent a combo box from selecting a value

I'm using a ComboBox with the DropDownStyle = "DropDownList". Programatically I set the DataSource for the items in the list. Something like this : combo.DisplayMember = "Text"; combo.ValueMember = "id"; combo.DataSource = ds.tbl; The list is populated correctly and the first element is selected. How do I prevent the first element fro...

Keeping one window in front of another

I am writing a UserControl that will act kinda like a drop down list, basically a textbox with a listbox that pops up underneath it... If the control is at the bottom of its parent form, I do not want the listbox to be clipped by the forms bottom, so from what I gather I cant just have this listbox as a child of the parent form.. I need...

How to separate the selected item of two combobox with a single DataSource?

On a form, I have two combobox wich have the same DataSource (their elements list are the same). When the user select an item in one of the control, the other control's selected item is also modified. That's not what I want. I'd like to have both list populated with the same DataSource (as I currently do), but I'd like their selected it...

DataView NullReferenceException in OnListChanged

I have a fairly complex WinForms app that uses data binding to tie strongly typed DataTables to controls (not sure if this fact matters here). An exception gets raised when a change to a column triggers logic that updates another column on that same row (or at least this is my theory). An example: a Customer record is bound to a Comb...

How to start WinForm app minimized to tray?

I've successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs when trying to start with the app minimized. At first the problem was that the app would be minimized but would still appear in the alt-tab d...

How to stop BackgroundWorker on Form's Closing event?

I have a form that spawns a BackgroundWorker, that should update form's own textbox (on main thread), hence Invoke((Action) (...)); call. If in HandleClosingEvent I just do bgWorker.CancelAsync() then I get ObjectDisposedException on Invoke(...) call, understandably. But if I sit in HandleClosingEvent and wait for bgWorker to be done, th...

How might I add an item to a ListBox?

I'm having trouble figuring out how to add items to a ListBox in WinForms. I'm trying: list.DisplayMember = "clan"; list.ValueMember = sifOsoba; How can I add items to the list with an int value (ValueMember) and some text (for the DisplayMember)? list.Items.add(?) I can't use ListBoxItem. Why? ...

C#: Problem displaying tooltip over a disabled control

I'm trying to display a tooltip when mouse hovers over a disabled control. Since a disabled control does not handle any events, I have to do that in the parent form. I chose to do this by handling the MouseMove event in the parent form. Here's the code that does the job: void Form1_MouseMove(object sender, MouseEventArgs e) { ...

center MessageBox in parent form

Is there a easy way to center MessageBox in parent form in .net 2.0 ...

How can I have context menu for selected text? &

Hello, 2 problems: In google chrome if you select a word (say problem) and then right click on this selected text, the context menu shows two items 1. Copy 2.Search google for problem 3. Inspect element. The context menu is different from the context menu of that entire window. How can I have this separate context menu for selected t...

Smooth movement of icon displayed on a Panel

Hi there! I'm coding an app where I display a System.Drawing.Icon object on a System.Windows.Forms.Panel using a code that goes something like so: Graphics g = _panel.CreateGraphics(); g.DrawIcon(this.NodeIcon, _rectangle); I have code to move the icon around using drag-n-drop. My problem is that when the user move the icon around, i...

How can I send GridView to Printer in C#

How can I send GridView to Printer in C# ...

How do I handle dragging of a label in C#?

I'm trying to build a form where the user can drag a label and drop it on a text box. I can find an AllowDrop in the text box, but there is no property such as "AllowDrag" in the label. Also, I created methods for all the drag & drop events for the label (DragEnter, DragLeave, etc) but none of them seem to work. I can not figure out how ...

Master-Detail GUI in .net

This type of UIs are frequently displayed in various web-Sites and .net books. Are these types of User-Interfaces acceptable and/or popular in commercial and/or customized Business Software? Please note (1) the use of Binding Navigator, and (2) the placement of Master-grid, Detail-grid and Input Area in the same form. To me a sea...

Bring window to foreground after Mutex fails

Hi, i was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. Eg - Application X is running but is in the background. I cant see it so i try to run another instance and because the mutex returns false the best thing to do is to br...

creating a .NET custom control

I want to create a control which is basically a ListBox, but each ListItem is a collection of controls. So each item of that list box is a combination of a Label, a CheckBox, a Timer and a TextBox. Can this be done with the .NET framework? If so, do you have any recommendations on how to get started, any links to samples or discussion,...