winforms

datagrid filter in c# using sql server

How to filter data in datagrid for example if u select the combo box in student number then input 1001 in the text field...all records in 1001 will appear in datagrid.....we are using sql server private void button2_Click(object sender, EventArgs e) { if (cbofilter.SelectedIndex == 0) { string sql; SqlConnection ...

Changing background color of the form with hexadecimal code.

I have one method named ChangeFormBackground(Color colorName) which changes the form background with the colorname which is the parameter of the method.Now when I call this method I have not color name but the hexadecimal code of the color and I want to change the background color of the form with that hexadecimal code using that method ...

C# Winforms - How to Pass Parameters to SQL Server Stored Procedures

my practice is that i fill use databinded listboxes and using a tablebindingsource and tableadapter. Then to get selective records in listbox i build stored procedure and select required records. But now i want that the stored procedure must take some parameter from some textbox value. like i to implement the following query string q...

List<T> vs BindingList<T> Advantages/DisAdvantages

Can someone describe what the difference between the two are for my project. Currently I have a List<MyClass> and set the BindingSource to that and a DataGridView to the BindingSource. I have implemented IEditableObject so when CancelEdit is called I revert my object back to what it was with a Memberwise.Clone() Will changing my List ...

Maintaining the size of the control which is located on the form when form is resized.

I have one form which size is (325,325) and on which one browser is there and the size of the browser is (321,298) means browser is in the middle of the form.And I want to maintain the size of the browser when form is resized like there should be the same difference of the size between form and browser as it was before resized. ...

How to scroll a flowlayoutpanel while dragging?

In my Windows Forms application, I'm using a FlowLayoutPanel control to display a list of items to users. I've been able to successfully implement reordering the items in the FlowLayoutPanel by having the user drag the control to the desired position within the FlowLayoutPanel. But I don't know how to scroll the FlowLayoutPanel when ...

How to inherit base Textbox to provide colored borders

I have a winform app that we use in house. It has many individual controls on each of it's 25 "pages"(usercontrols). Our user base prefers very technicolor apps...they want a TextBox to be outlined Blue if it is a required field (color should go away if data entered). They want a TextBox to change to outlined Green if data has been ch...

Updating an Application on a locked down user's PC.

I am writing a Windows forms application to go between our other systems and our new software package that we are still setting up. I am doing an iterative development method because I am creating the tools as we find that we need them. My problem now is that when I publish a new change, we have to go to the workstations, log in as admin...

SQL query debugging required

i am working in winforms with C#. heres my code query = "SELECT max(Appointment_Time) FROM Appointments WHERE (Appointment_Status = 'D')"; dset = db.GetRecords(query,"Appointments"); ctime_Label.Text = dset.Tables["Appointments"].Rows[0]["Appointment_Time"].ToString(); db.GETRecords is a function of the class that provides me sql-serv...

DirectShowNet and anoying screen

Hello everybody. I'm using DirectShowNet.dll to grab a photo of my web camera. Anytime my camera initializes it first shows me this screen. Where can I turn it off? http://www.goat-it.com/!tino/screen.jpg Thank you ...

What tools exist that help me reference topics within a .CHM from a WinForms app?

I have inherited both an existing WinForms app and an existing .CHM file, created using Dr. Explain. I need to reference different topics within the CHM from different parts of my WinForms app, but I don't know what topics, if any, are defined within the CHM. Is there a tool that lists all existing topics that I can reference using the S...

Adorners for C# Windows Forms

Hello, I have a canvas (Panel Control) in my WinForms app where users can drag things like textbox's, labels etc around. But I want to make it easier for them to more precisely align the objects. I've read into it and Adorners seem to be the way to go? But, apparently it's only for WPF. WPF is not an option for me, unfortunately. What ...

Exception claiming mainForm is disposed when timer event executes

I have a win form that is using a System.Timers.Timer. When the timer executes it updates a variable on the mainForm. I am getting an exception telling me that mainForm has been disposed. What am I doing wrong. If I take out updating the variable the program runs fine. If I try and read the variable and post it to a message box, eve...

C# copy, paste a form in a Visual Studio project

I want to create a new form that is almost a duplicate of a dialog I already have in my project. I don't want to waste time recreate most of the form scratch if I don't have to. I copy, then paste it into my project, and rename it from Copy of Original.cs to NewItem.cs. When I goto rebuild my solution, I get an error. The item "obj\D...

InvalidDeploymentException error when deploying .NET Application.

I have two projects: Inventario, Produccion Dampers and I added Inventario as a reference to Produccion Dampers. When I publishProduccion Dampers I don't get an error but when I try to install I get this error: Following errors were detected during this operation. * [2/11/2010 3:33:34 PM] System.Deployment.Application.InvalidDeploym...

Visual Studio Designer keeps trying to initialize my Collection property

I've created a UserControl called CatalogBrowser which has a property ListedFamilies that exposes the currently listed Family objects in the control. Here's the code for the property. public List<Family> ListedFamilies { get { List<Family> returnList = new List<Family>(); foreach (Object obj i...

How do I install the Mono Winforms Designer on Mac OS X?

I've searched around but was unable to find a good, clear, answer. Can someone please explain to me how I can install the Mono Winforms Designer on Mac OS X? If it's not possible on OS X, can it be done on Linux? And if so, how? Any and all help is appreciated! Thanks. ...

What design pattern do I use to synchronize changes in the object model state to the GUI's state?

I'm commonly working on GUIs where I want to directly prevent a user from doing things they should not be able to do by disabling controls on a form. For example maybe I don't want the "Process Widgets" button to be enabled unless the user currently has a "Widget Project" open in the application? Or the "Cancel Processing" button only be...

Please give reference/guidance to make a web application for managing all IT assest/devices

Please give reference/guidance to make a web application for managing all IT assest/devices . Application consist of two component Web application and Windows .NET Application. Client Windows .NET Application scan all active network & find all IT assests like printer,scanner & upload all data into the web application. Now our team usin...

How to set default selected item of listbox in winform c#?

I try to set like this: ListBox lb = new ListBox(); /* Bind datas */ lb.SelectedItem = someObject; lb truely selected the someObject item. But it would select the 1st item at first. And that motion cause SelectedIndexChanged event which I don't wanted. I just want SelectedIndexChanged be called when someObject selected. How co...