winforms

Hierarchical Gridview

Hello everyone. I need to bind hierarchical List object to a Gridview (Hierarchical in windows form). How can this be achieved - any examples ?? Ex: of list object List of CargoMovement => Cargomovents and each CargoMovement has List of Transactions thanks for help ...

Application Role connect to SQL Server with "Login Failed" error

Hi all I have a program which would use the Application Role to write data to a SQL Server 2005. using (SqlConnection sqlCon = new SqlConnection(connectionString)) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlCon; sqlCommand.CommandTyp...

Why do my Windows Forms strings look so ugly when anti-aliased?

I'm rendering some strings manually on top of a GraphicsBox, because you can't have a Label with a treansparent backdrop. No matter which rendering mode I try though, I can't get the strings to look any good (ie. as they would appear in Word or in a graphics program. Here's a picture of the interface mockup compared to what renders ons...

Windows Forms Designer destroys form layout

This morning I stumbled over a weird issue in Visual Studio's Windows Forms designer. I have a form which worked for about a month now without changes. It looks like this in the application: (text made unreadable because I'm not entirely sure of the legal implications here). Now starting today, apparently (I think I had the form open...

Windows Handle Issue

Hi all, Facing an issue where in the user objects goes more that 10000 in windows app and the app crashes. After much analysis we realized that we need to get rid of the panels that we use to align the controls and may be reduce the possibility of user objects reaching 10000. Our App UI is dynamically generated driven by a configura...

Send values from one form to another form in c# winforms application

I want to pass values between two Forms (c#). How can I do it? I have two forms: Form1 and Form2. Form1 contains one button. When I click on that button, Form2 should open and Form1 should be in inactive mode (i.e not selectable). Form2 contains one text box and one submit button. When I type any message in Form2's text box and click...

How to logout from my winApplication in .NET

I use a login from to access the main application. There is a logout option from the main application, which i'm not able to implement, even after googling and trying some things like: Application.Restart(); or Application.OpenForms["loginForm"].ShowDialog(); mainForm.Close(); Help needed to implement a simple logout option. There'...

How to display progressbar during copy

Hi I have C# form which provided with button and picturebox this button have main job which is (open dialog to choose file) after that this file will be copy to specific folder if this file was huge I need my form display progress bar and increase until file copied "How I can do that" ...

VB.NET - How to Hide a Form in Cross-Thread Operation

Hi u all, I need a function to Hide a form in cross -thread operation. I write this code but it close the form and not only hide it: Dim objHideMyForm As delegateUpdateApps = AddressOf HideFree Private Sub HideFree() Try Me.Hide() Catch End Try End Sub Public Sub HideMe() Me.Invoke(objHideMyForm) End Sub Can any...

Select value in a ComboBox loaded with Objects

How can I select the item in the comboBox with key "02"? public class GenericComboBox { private string _key = string.Empty; private string _value = string.Empty; public string Key { get { return _key; } set { _key = value; } } public string Value { get { return _value; } set ...

C# - how do I refresh DataGridView after removing rows

Hello, In my code I need to remove rows from the DataGridView after a recurring interval, and so I call the following function when a timer expires: private void removeRows(DataGridView dgv) { foreach (DataGridViewRow row in dgv.Rows) { // if some condition holds dgv.Remove(row); } dgv.R...

C# assembly has different sizes after each compilation (Visual Studio)

Here is a little something we noticed today and we do not have an explanation for it. My co worker compiled his current project (C#/WinForms/Visual Studio) and the dll was about 170 kb in size. He compiled the same project again and the dll was 220 kb in size. He did not touch anything else just hit the compile button again and the outp...

Binding a DataGridView to a DataTable but also including a ComboBox as the last column

Right now I have a DataGridView that's bound to a DataTable that works all well and good. What I need to do on the DataGridView is include a new column at the very end that is a ComboBox that will dynamically filly based on the key value of the row. My columns are ID, Name and Count. The 4th column will be a ComboBox that takes an ID a...

winforms datagridview sorting using LINQ

Hi there! Im using Linq...more specifically, PLINQO. anyway the following is an example of a query I have bound to a datagridview (winforms): public static List<Task> GetUserTasks( Guid userID ) { using (myDataContext ctx = new myDataContext()) { try { return ctx.Manager.Task.GetByUserID( userID ...

Location of labels

I'm trying to find out if there is a way to determine if a label is in a given location on a form. Basically the user will drag a panel into 1 of 225 labels and I need to determine which label the panel is on. Jon ...

winforms Tooltip in winforms DataGridViewImageColumn

Hi again! I have the following code that successfully displays an image in its column based on its bound DataProperty: private void dgvTasks_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e ) { if (dgvTasks.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.ColumnIndex == 1) { e.Value = ( (...

How to send email from windows form app with log4net

I have set up log4net in my C# 3.5 windows form application. I am looking for how to send email from a client pc with log4net. The SMTPAppender requires knowledge of SMTPHost and the examples I've seen are for web applications. Is there a way to send email from an application that will work on any client's computer that may or may not...

Self-referencing hierarchy in GridView

Hi, I recently read that self-referencing hierarchy is now supported by Telerik's radGridView. Unfortunately, I have been unable to locate any demos, tutorials, or sample code to look at. Is this information available? Here is my current code that I'm working with: private void SetupElementsGrid(){ radGvElements.Columns.Clear(); rad...

Opening default web browser

I am using the function below to open the user's default web browser. Public Function ShowHelp(ByVal url As String) As System.Diagnostics.Process Dim startInfo As New Diagnostics.ProcessStartInfo() startInfo.FileName = url startInfo.WindowStyle = ProcessWindowStyle.Maximized Return System...

Anchor ToolStripProgressBar to right of StatusBar(StatusStrip)

I have a form with a statusbar that has 2 ToolStripStatusLabels followed by a ToolStripProgressBar. I want the progressbar to be always anchored to the right of the statusbar - so when the windows is resized/maximized, it should automatically move/repaint. I thought this would be as simple as setting the 1st (left aligned) ToolStripStatu...