winforms

Query a winforms control with CheckedListBoxItemCollection.AsQueryable().Provider.CreateQuery(...

Hello, I need to query a winforms control(CheckedListBoxControl) having a CheckedListBoxItemCollection which I want to query for a certain Id that is within the property "Value" of the CheckedListBoxItem. CheckedListBoxItemCollection items = myCheckedListBoxControl.Items; foreach(Department dep in departmentList) { bool isDepExisti...

Firing a Button's Click event from outside Button

I have a Button and I need to fire it's Click event externally from actually clicking it. However, the code myButton.Click(this, EventArgs.Empty); gives me the error The event 'System.Windows.Forms.Control.Click' can only appear on the left hand side of += or -= How can I fix it? ...

How to bind List<> to a column in ListView

I've got a DataTable with this fields datatable.Columns.Add("ProductID", typeof(int)); datatable.Columns.Add("LocationList", typeof(List<string>)); datatable.Columns.Add("LocationIds", typeof(List<int>)); datatable.Columns.Add("ProductName", typeof(string)); datatable.Columns.Add("Brand", typeof(string)); datatable.Columns.Add("Price", ...

How to bring up Find dialog from a web browser control?

I have a web browser control which has navigated to a given page and is ready. Now I want to bring up the Internet explorer find dialogbox whenever the user clicks a specific button on my page. The user can already bring up the find dialog box by clicking 'ctrl+f', but I want a separate button for this action too. I have found this: htt...

C# Perform drag drop between datagridrow to treenode and vice versa

Hi all, I have datatree (kind of folder tree) that each folder represend as node. Next to it, I have datagridview that each row in it represent the treenode content. What I need is to drag and drop node from the treeview to the datagridview and vice versa. Does anyone have an idea or reference of how to do it? ...

Combobox in DataGridView

Hi, How do I setup a selected value for a combobox column in datagrid? I can't use "Select Value = 1;" like in a regular combobox, so how do I do that? to be more specific : I have a datagrid which is consisted of two datasets tables: one table which contains 300 entries for different types of cars, and a combobox column which contain...

C# Receiving remote commands over TCP and invoking them on WinForm (Multithreaded)

I have a console that I want to use to invoke commands on a WinForm in another computer (I'm testing it through localhost though). When the form starts, it instantiates the CommandListener to receive commands over TCP. Whenever I attempt to instantiate it without a separate thread, the winform doesn't display at all, so I used "Initiali...

how can I restart winform ?

I have two windows form in C# . f1 calls f2.I use message box.if the user press 'ok' , the program most restart f2 again and if press 'cancel',program close f2. for pressing 'ok' : I couldn't use 'Application.restart()',because all program restarted and I just want to restart f2. when I use " f2 f=new(); f.show();this.close();" all pro...

How does one output arbitraty text from INSIDE a control class in C# ASP.NET, MVC?

Is it possible to say something to the effect of 'SomeClass.Out.WriteLine("hello world")' and have it actually show up for the browser to render? I ask, because I notice that the HtmlHelper BeginForm implements IDisposible. So at the end of the using block, a closing tag is written to the browser. I am not saying I would use this pr...

How do I determine an MDI child form's screen location?

I have a main form 'MainForm' with IsMdiContainer = true I have one or more dynamically created child forms where I set MdiParent = MainForm Now what I want to do is to be able to detach these child forms by setting MdiParent = null, but with maintaining the exact same screen location. I've tried to use ChildForm.PointToScreen(ChildFo...

Keeping winform control centered after window resize

Using Visual Studio 2008, windows forms, C#, .NET 2.0 ... Is there a code-less way to get a control (it happens to be a PictureBox in my case) to stay centered as the window is resized? In other words, using some combination of property settings rather than writing code by hand to keep the element centered. For example, there's a butt...

Windowsless application, threads and Invoke()

Let's suppose I have windowsless application: only NotifyIcon is presented. So I've created the only NotifyIcon that I need. But when I had a Form1 class I could use form1.Invoke(action) to perform actions from another thread. And what should I do now? UPD: this is an answer: we should Invoke() a menu itself if (mnuTrayMenu.InvokeRequi...

Causing another application to copy data to clipboard

I'm trying to programmatically make an external WinForms application copy its data to the clipboard, and it's driving me crazy. Since pressing Ctrl-C in the application does the right thing, I've been trying to send ctrl-c using my C# application to the other application. Here is my sequence of commands. I compared the messages using S...

silverlight app realtime update design

I have a winform app, which takes live image from an ip camera, and detect vehicle license plate number from the image. Now i want to make a silverlight app which can connect to my winform app or some kind of service app, and the silverlight app gets updated whenever a new license plate number is detected, what service/architect should i...

How to create a form with a border, but no title bar? (like volume control on Windows 7)

In Windows 7, the volume mixer windows has a specific style, with a thick, transparent border, but no title bar. How do i recreate that window style in a winforms window? I tried setting Text to string.Empty, and ControlBox to false, which removes the titlebar, but then the border also disappears: ...

How Can i Fetch a Customized Folder Path using GetFolderPath?

string downloadArea = Environment.GetFolderPath((Environment.SpecialFolder.MyDocuments) + "\\My Personal Documents\\CVs"); I'm trying to get the path ends with .....\My Personal Documents\CVs My Personal Documents and CVs are folders that reside under MyDocuments. The above code gives me a compiler error that says: The best overl...

Is there any way to hook-up all http requests from all browsers using .NET?

I'd like to have an app which would have access to all requests send from any browser at the current pc. I don't want to have any kind of a proxy server,beacuse you have first adjust the browser settings. Is this even possible using .NET ? ...

C# / .NET: Move to desired Item in BindingNavigator

I'm using such a BindingNavigator to let the User move through Data Records of a BindingSource. How can I change the displayed page to a desired page number through the program? I already set the PositionItem to the desired page number, but that just changes the displayed page number and doesnt move to this page. I'm sure it's not di...

Pattern for periodically updating screen data

I am new to the world of GUI programming and I am writing a little GUI app using IronPython and WinForms. It reads values from an external device and displays them in a ListView component (name, value). I want to periodically perform the reading and updating of the ListView component at a certain fixed rate. I had the following ideas to...

Adding background image to MDI form

Hi I would like to request people to give me inputs on how to show a background image in a winforms MDI Application. I understand that it is possible through the MDI form. Any inputs on how to go about it would be welcome. Thanks so much Regards bornagaindeveloper ...