winforms

Locking a xml file(located in a server) when the same application(from 2 different computers) is trying to write into it

Hi All, I have a winapp which writes data into a xml(Data.xml). This xml is my data store. The winapp will be used by atleast 10 ppl. Sometimes 2 users may simaltaneously import some data and store it into Data.xml(import usually takes 60-100secs). During this period which ever process got the first access on Data.xml must hold a lock ...

PropertyGrid - Possible to have a file/directory selection button next to a property value?

Is it possible to have a file/directory selection button next to a property value in the PropertyGrid? Hitting the button would launch a standard "Open File" or "Select Directory" type of dialog. In a perfect world, this could be done using an Attribute on the SelectedObject's property. ...

Where should a WinForm app keep its logs?

I am working on a WinForm application, that allows working to work with "projects" (think about the application as Visual Studio, and projects as VS Solutions). My question is - where should the application keep its logging files? Some requirements include: the application might not be running as an administrator (so saving in the %P...

Why doesn't Close() closes the form in the load event?

In my load event on a form, I call some method in a try catch block. When an Exception occurs, I show the user a message and after that I want to close the form. It looks like this (code in Load event): try { Metehod(); } catch(DatabaseException ex) { MessageBox.show("db error! " + ex.Message); this.Close(); } catch(Exception ex)...

Create a "floating" control in C# (WinForm app) without WPF

Hi, I want to create a "floating" control - like Visual Studio's ones (The solution explorer, for example). How can I implement such thing? Thank you. ...

Show Youtube Videos

Hi I want to show youtube videos (not website) in my software (winform) , how can I do this ? Is there any way so do not require Browser ? ...

Minimize on FormClose prevents computer shutdown

I have a simple Form-Based .NET application. In this I capture the FormClosing Event to prevent the closing of the application, instead I minimize it. The application should always be open. Here is the code I use: private void Browser_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; this.WindowStat...

Looking For A WinForms Time/Scheduler Control

A bit of a long shot but I'm looking for a .Net WinForms scheduler style control that lists times down the left and resources along the top. I've found lots of schedule controls that list days along the top and times down the left but I really need something slightly different. I'm happy to buy the control if a free version does not exis...

BindingSource, set datasource and then set a NEW datasource

Hi all, I've got a BindingSource with only 1 object as the DataSource. I bind on some values on the datasource. That works perfectly. BUT. When I do: bindingSource.DataSource = new Foo () { Bar = "..."; } this is not reflected through the UI. is there a way to force an update? I tried resetbindings on the controls that bind to...

ContextMenuStrip loses the focus from an item in the tree view if it is right clicked

I have a contextmenuStrip associated with a tree view. Now for instance, i have four nodes in the tree structure and Node 4 is selected. Behavior: ContextMenuStrip - When u right click on the Node 2 , that node is selected and as soon as the context menu strip opens up, the focus goes back to Node 4. With old component 'Context Menu'...

WebBrowser automated login maintin session usning .navigate() in same website?

I have a problem maintaining the session after logged in successfully through automation using the: doc.GetElementById("username").SetAttribute("value", "user"); doc.GetElementById("password").SetAttribute("value", "pass"); doc.GetElementById("submit").InvokeMember("click"); it directs to the main page after logged in. How do i navig...

Winforms Usercontrol: Perfomance issues when creating and adding to parent.

Hi there, I have built a UserControl for display a list of other UserControls which themselves are bound to individual data objects. The link below shows an example implementation of this control. Each of the individual user rows is its own UserControl/XtraUserControl, laid out in a FlowLayoutPanel. The problem I have is with perfo...

Background colour of DataGridViewCheckboxCell

I have a DataGridView bound to a list of objects, and I'm setting a dynamic cell background colour using the CellFormatting event, as in this answer. This works well for every column except the DataGridViewCheckboxColumn. When I click inside this cell (but outside the checkbox) the cell background changes to the default white. Visually...

char* or wchar_t* to textbox

Hi. I have this code. char* cbuffer; wchar_t* wbuffer; cbuffer = _getcwd(NULL, 0); wbuffer = _wgetcwd(NULL, 0); Also, I have textbox1 and textbox2. How can I put cbuffer in textbox1 and wbuffer in textbox2. Thanks. ...

Change DataGridViewCell user input handling behavior

I have a winform app with a TimeSpan column that displays the hours/minutes part of a date. When the user enters text it is converted to a TimeSpan using TimeSpan.TryParse(). This works as expected when the user input is "11:00" in setting a value of 11 hours. The problem is that if the use enters "1100" it is parsed as 1100 days whic...

How do I implement a double-right-click for winforms?

This question seems to point to the existence of a windows event for a double-right-click. How to implement it in a C# windows form, however, is less than clear. What's the best way to implement double-right-click on a control such as a button? (I'm thinking I must use MouseDown and keep track of the time between clicks. Is there a bet...

Using ActiveX control in WPF

I'm attempting to host an ActiveX control in a WPF app. After attempting to use existing info on the web and here, I've hit a dead-end. I need to use an ActiveX control provided to communicate with a UV power meter. They provide an application that registers and uses the control and even includes some useful demo apps. I stripped out th...

Icons in TabControl C# - How?

I can't seem to find an answer for this anywhere. An icon before the label on the default tabcontrol tabs would suffice for my needs. Thanks in advance. Q: You need to clarify what library set you're using: Winforms, WPF, ASP.Net, GTK#, etc. – Nathan Ernst A: You are totally right, my mistake. I'm using Winforms. I switched back from ...

How to change ListBox selection background color?

It seems to use default color from Windows settings which is blue by default. Let's say I want to change it to red permanently. I'm using Winforms. Thanks in advance. ...

Using webcams in C# WinForms

How do I use a webcam in C# WinForms? ...