winforms

How to databind to a DataGridViewLinkColumn

I am trying to bind a DataSet to a DataGridView. I dropped a DataGridView in a Winform. In the designer I set DataGridView to have a column with ColumnType DataGridViewLinkColumn. The DataSet is bound to the DataGrid with this code dataGridView1.DataSource = dataset; dataGridView1.DataMember = "incidents"; The DataSet dataset is co...

is it possible to have a datagridview automatically update when the database it is bound to gets updated?

I have a C# winforms application that has a single datagridview to display the contents of a table in a mySQL database. Is it possible to have the datagridview reflect changes to the database in real time? i.e. when i make a change to the table directly, it will show that change in the datagridview ...

Doing all validation at once

When trying to validate controls on a windows form I realise the .validated() for each controls fires when the focus is lost. Instead I'd like to validate only when the button is pressed at the bottom, how would I do this? ...

Setting header color for Tabcontrol.Tabpages in winforms. .??

hi, how to set header color for tabpages in WINFORMS. and also the back color. In my code.. For j = 0 To dataset4Category(i).Tables.Count - 1 Dim Finder As Integer = Decimal.Floor(((dataset4Category(i).Tables(0).Rows.Count) / 30)) key = dataset4Category(i).DataSetName name =...

Passing array of strings from JS to C# inside WebBrowser control

I'm using ObjectForScripting property to interact with web page inside WebBrowser control and everything works fine except I can't figure out how to pass array of strings back to C# HTML code <input type="submit" onclick="window.external.save(Array('test', 'test2'))" /> Form // Returns System.__ComObject public void Save(object para...

How can i find out the Last row in a datagridview and write it to text file

I would like to find the last row of the datagridview and i would like to write that particular row data to a text file can any one help me ...

Replacing td tags with td and attributes

My Problem is for particular case occuring in my project. in my Html document, i want to replace <td> with <td class=”right”> for all tds except first one in a <tr> tag. (if there is <tr> inside a <tr> tag then that also needs to be handled). if input is like <tr> <td>1</td> <td>2</td> <td>3</td> <tr> output should be like ...

WinForms: object data source usage best practice

I want to bind list of business objects to Winforms control (DataGridview, ComboBox, e.t.c.). There are several approaches to do that: I can create wrapper classes for business objects and override their ToString method implementation. That will work nice for ComboBox, ListBox Items.(Add|AddRange) methods. But this will not work fo...

.NET WinForms Anchor Property

Hello. I have a form that has a panel in it. I've set the panel anchor and it works great, when I resize the form the panels height is increased. The problem is: I've got several group boxes in the panel, and when the panel's height is increased, the group box vertical spacing should be increased equally. How can I do that? ...

How to check whether treeview root node has child nodes exists or not

I have a treeview with a root node initially as Root. If i right click on Root node i will have a context menu displayed with some options as New and other if i select New i will add a child node to the Root node. If i again Right click on the Root node and if the Root has child nodes i would like to clear all child nodes and add a new c...

Check on .Net framework version from WinForms app

How to check the .net framework version on start of WinForms application that wrote on .NET 3.5? If .net 3.5 is not installed, the application should show the message about it (may be with link on .net installer or some else). Now it show some error that is not clear for user. ...

C# .net refresh whole page contained in splitcontainer

Ok take a look on the pic My all pages are loaded in the SplitContainer1(Horizontal).Panel2(right one). I want to do a full page refresh contained in the Panel2. As the SplitContainers are contained in the MDIParent, here comes the problem. If i close and reload the page it does not reopen as child in the Panel2 else opens as a standa...

backcolor of readonly richtextbox

I have a winforms app with a series of textboxes and one rich textbox. Upon a button click I would like to set all the fields to being readonly. The only issue with this is that the background color of a readonly richtextbox is white as opposed to the grey used by the textboxes. I have tried setting the backcolor property of the richte...

User account name not updating in c# WinForm Application

I am editing a c# WinForm solution and I do not understand the code that gets the user account name. The code is shown below. The application shows a customized form for each user account and the user account name is needed to get user-specific configuration values from an SQL database. What happens, to the best I can tell, is the ret...

Is there any way to get smooth (preferably Windows default) animations in my .NET winforms app?

In my application I'd like to provide some animations while a lengthy operation is in progress. Currently I'm at the "connecting to server" stage, which typically takes over 5 seconds. During this I'd like to display some animation to the user. I've already implemented the popular solution with a PictureBox and an AJAX loading gif, but ...

Silverlight (like) Validation in Windows Form app

I need to Enable/Disable my SAVE button in real time based on data in my fields. Is the below an acceptable way on accomplishing this? It feels wrong but I don't know how else I could accomplish this. Each User Control(CRUD Form) has a BackgroundWorker and the following related methods; StartBGWorker() StopBGWorker() RequiredFields...

How do I need to modify my WinForms app to also run in the console?

I have a .NET WinForms app written in C#. In order to support batch operations, I'd now like to make the app able to run in the console. Is it possible to have an app that detects on startup whether it is running in the console or not? What modifications do I need to make in order to achieve this behaviour? ...

How to keep user settings on uninstall

I'm using .NET user settings feature and I'm facing a problem. When the application is uninstalled, then installed back, the user settings are lost. I understand it's by design, and I want to be able to give the choice to the user in the installer. Could you please give me some pointers to articles or documentation that will helps me?...

How to get form to appear for all user accounts

I am editing a c# WinForm solution that shows a user-customized form for each separate user account. The solution includes two projects where one project runs in the background with a timer that calls the other project, and that project generates the user-customized form. The problem is that the form only appears when I use the admin a...

Is there a way to programatically insert a Windows Forms control into an MSHTML (WebBrowser) instance?

I have an application that uses an embedded IE through the Windows Forms WebBrowser control. I want to embed some .NET controls into the HTML page. There is old support (since .NET 1.0) to use a special classid in an <object> tag (dllname#controlname) but through experimentation I have found that it only works if the dll is served over ...