winforms

C# TabPage.Controls.Add too long

At run time, I add one control to a tabpage and I notice that it takes 0.5 sec to do it. It's rather long and I would like to reduce this time. I tried Suspend/ResumeLayout but for only one action it's no relevant and do not improved anythng. Any ideas? ...

C# - How to change window state of Form, on a different thread?

Hello. Does anyone know how I can chage the window state of a form, from another thread? This is the code I'm using: private void button4_Click(object sender, EventArgs e) { string pathe = label1.Text; string name = Path.GetFileName(pathe); pathe = pathe.Replace(name, ""); string run...

Initialization of objects in the background

I need to initialize few objects, it can take a while so I want to do it in some background thread. I also want to display progressBar showing what is the progress of initialization. What is the most elegant way to do it? I was thinking about an interface: interface ILoadable { int Progress { get; } event EventHandler Loaded;...

Binding an Ilist to datagridview containing another object in a field

I have pretty much the same problem as this question http://stackoverflow.com/questions/970741 but in windows forms, can anyone help me solve it? this is my code, so you don't have to check the other question: public class Material { public virtual int id { get; private set; } public virtual string nombre { get; set; } publi...

Weird error on specific computer. Setting Url

Hello All, I have a weird error on a specific windows XP box when I run my reports. I'm wondering if anyone else has run into it before. I show a preview of my reports using a webbrowser control. First I generate a pdf and save it to disk and then I direct the webbrowser control to it's location. See below. string pdfNa...

seeing C# windows forms project code from F#

I have a C# Windows Forms project open with some C# code in it. Question: How can I have an F# file that I can write F# code in but still referencing all the C# code I have on Form1.cs (including the GUI). I can successfully do this: - Create a C# Windows Forms project - Create a F# Library project - Reference the F# Library DLL from m...

beautiful win forms application design in c#

Hi. How to design a beautiful win forms UI.(a little like MSN message client) I googled and couldn't find the way to start my befault win forms learning. Did I miss some C# win form design tech? Must I start .net 3.5 study? .net 2.0 vs2005 used. ...

Dynamically set method for tabPage

Hi, I have TabControl. I added it to tabpages. To one of them(tpTags) I dynamically add usercontrol tagsModule. When I'll click at tpTags I wanna to call method on tagsModule BindData NEW CODE: TabPage tpTags = new TabPage(); tabControl1.TabPages.Add(tpTags); ...setting properties... TagsModule tagsModule = newTagsModul...

How to make return value optional for a method,if possible ?

I have a method private static DataTable ParseTable(HtmlNode table) and sometimes this method has no return value then I want to make return value optional, is it possible ? I have tried with if condition.But there is error. How can I make return value optional for the method if possible ? ...

How to Store data without using Database and how to retrieve them ?

I am parsing the html file to extract tabular information through column names. And I want like let user give the input for column name. And according to that column names tabular information will be extracted. Now that column names which user will input,based on that column names I want to find the tabular information from the html fil...

What pattern to use in this scenario?

Hi, We have got many forms(windows app C#) in our application.We have similar steps in most of them - user adds a new object(in a grid),fills values and save.On,save,we validate,and save if everything ok,else show message.Now,adding of object usually means we add a new row with some default values. ...

How to control docking order in WinForms

As the title states, I'm looking for a way to control the order in which the items dock to the top of my control. I've played with the windows form designer, and i cant seem to find what the RightClick->Order->SendToFront is doing, because thats exactly what I want to happen. As far as I can get to happen, as I add my contents to my co...

Freeze the indent of a row group in DevExpress GridControl

I am required to display a DevExpress WinForms GridControl where the rows must be grouped by a date column. When horizontally scrolling the grid, I am required to keep the group row and group indents fixed to the left of the control (so they do not scroll with the columns). I have so far been unable to find any built-in capability for ...

CheckedState inconsisten in Treeview using Find Method

Hello, I'm using a Treeview control in a .NET 3.5 c# project and I'm noticing inconsistencies in the checked property when I use the find method of the Treeview control. I'll check some leaves (nodes with no children) and then click a button. Inside the button click I'm using the find method of the treeview control to locate the node an...

Windows Forms' PictureBox with zooming and panning

My application needs control displaying bitmaps (jpg) but also zooming and panning them (so if you press mouse button you can 'move' zoomed picture inside frame) What I did was placing panel at the Form, then pictureBox inside panel (anchored Top,Left). So if I need zoom it I'm just executing below code from Zoom buttons events: pr...

C# embedding images, reports, schemas

I've seen some examples, but trying to better understand how "Resource" files work, such as embedding images, reports, schemas, etc. If building an application, I want to make sure everything is available when deployed, but for things like reports and schemas, I don't want anyone accidentally deleting, renaming, or otherwise mucking aro...

C# Generics and Winform

Is it possible to pass a generic type T into an instance of a winform so T is usable throughout the form? ...

GetWindowPlacement/SetWindowPlacement not working in WinForms for high DPI

I've got a legacy WinForms app and I want to save the window position and size across sessions. I've been using GetWindowPlacement and SetWindowPlacement during the FormClosing and Load events. The problem I'm getting is that at higher DPI settings (Such as Medium, size at 125%) the sizes keep inflating. I'll call SetWindowPlacement on i...

C# graphics flickering

Hello, I am working on kind of drawing program but I have a problem with flickering while moving a mouse cursor while drawing a rubberband line. I hope you can help me to remove that flickering of line, here is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing...

DateTime formatting in SSRS ReportViewer always uses en-US?

I'm having a show-stopping issue with the ReportViewer component that's part of SSRS. I'm working on a WinForms application and have a couple of local reports that show DateTime values from the database in various locations. Regardless of how the formatting is done (no formatting at all, using "d" in the Format property, or using FormatD...