Search Results

Search found 3559 results on 143 pages for 'winforms interop'.

Page 56/143 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • .NET: How to know when serialization is completed?

    - by Ian Boyd
    When I construct my control (which inherits DataGrid), I add specific rows and columns. This works great at design time. Unfortunately, at runtime I add my rows and columns in the same constructor, but then the DataGrid is serialized (after the constructor runs) adding more rows and columns. After serialization is complete, I need to clear everything and re-initialize the rows and columns. Is there a protected method that I can override to know when the control is done serializing? Of course, I'd prefer to not have to do the work in the constructor, throw it away, and do it again after (potential) serialization. Is there a preferred event that is the equivalent of "set yourself up now", so that it is called once whether I'm serialized or not? The serialization i speak of comes from the InitializeComponent() method in the form's code-behind file. #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { ... } It would have been perfect if InitializeComponent was a virtual method defined by Control, then i could just override it and then perform my processing after i call base: protected override void InitializeComponent() { base.InitializeComponent(); InitializeMe(); } But it's not an ancestor method, it's declared only in the code-behind file. i notice that InitializeComponent calls SuspendLayout and ResumeLayout on various Controls. i thought it could override ResumeLayout, and perform my initialization then: public override void ResumeLayout() { base.ResumeLayout(); InitializeMe(); } But ResumeLayout is not virtual, so that's out. Anymore ideas? i can't be the first person to create a custom control.

    Read the article

  • Automatically resize TableLayoutPanel

    - by Armagan
    I have a programmatically created TableLayoutPanel. It works fine but I couldn't find something: how can I make it size columns automatically when the form is resized? The panel is set to Dock.Top and when I resize the form instead of sizing every column as percents, only last column grows. What can I do for this? Here's how I add ColumnStyle for each column: this.tablePanelFilter.ColumnStyles.Add( new ColumnStyle(SizeType.Percent,Convert.ToSingle( Math.Ceiling((decimal)100 / (decimal)columnCount))));

    Read the article

  • Sorting a GridView

    - by Markus
    Hi, I have a question regarding GridView windows forms control. As a datasource, I am using a DataTable object. When the grid view is sorted, the DataTable's row indices are not sorted. In this way, when accessing the DataTable using indices from GridView, I get the unexpected rows. How can this situation be handled?

    Read the article

  • C#: standard Windows menu bars in Windows Forms

    - by BoltClock
    I noticed that adding a MenuStrip (from the VS Toolbox) to my form design doesn't yield a menu bar like many native Windows applications. Instead I get a menu bar like VS's own. None of the style settings for MenuStrip appear to mimic the much more common native menu bar. Is there a way to add a menu bar to my Windows Forms application that looks the same as the one you see in Notepad, Task Manager, Windows Explorer and others? (Preferably with the designer, but I wouldn't mind adding it programmatically either.)

    Read the article

  • Read text file into listbox collections

    - by Arcadian
    Hi, i'm new to C#. I need my program to show different parts of the data contained in a txt file into different listboxs (which are on different tabs of a form) so that the user can see the particular block of data they are interested in. the data contained in the txt file looks like this: G30:39:03:31 JG06 G32:56:36:10 JG04 G31:54:69:52 JG04 G36:32:53:11 JG05 G33:50:05:11 JG06 G39:28:81:21 JG01 G39:22:74:11 JG06 G39:51:44:21 JG03 G39:51:52:22 JG01 G39:51:73:21 JG01 G35:76:24:20 JG06 G35:76:55:11 JG01 G36:31:96:11 JG02 G36:31:96:23 JG02 G36:31:96:41 JG03 though much more of it :) The separate listboxes will contain only the lines who's first integer pair matches that listbox's name. For example, all the lines that start "G32" will be added to the G32 listbox. I think the code would start something like: private void ReadToBox() { FileInfo file = new FileInfo("Jumpgate List.JG"); StreamReader objRead = file.OpenText(); while (!objRead.EndOfStream) but i'm not sure where to start in terms of getting it sorted yet. Any help? There's some rep in it for you :D

    Read the article

  • How to report DataContext.SubmitChanges() progress with LINQ2SQL

    - by kzen
    If there is a foreach loop that contains DataContext.Customer.InsertOnSubmit(cust) for example: foreach (Object obj in collection) { Customer cust = new Customer { Id = obj.Id, Name = obj.Name ... }; DataContext.Customer.InsertOnSubmit(cust); } And outside of the loop there is a call to: DataContext.SubmittChanges(); Is there a way to obtain the SubmittChanges progress in order to report the progress back to the user (or a different approach without moving the SubmittChanges into the loop)?

    Read the article

  • Simple regex question (C#, MS SQL)

    - by Vytas999
    Hello, I have some Regex, it looks like this: string regexForDrop = @"^((%27)|'|(\-\-))\s*(d|%64|%44)(r|%72|%52)(o|%6F|%4F)(p|%70|%50)$"; It works fine, when i write to the input "--drop", but it does not works, when i write "drop table users" or something like that. I need that it would be working, no matter what comes after "--drop". How i can implement that? Thanks

    Read the article

  • Handle ConstraintException and get ColumnName that cause the error

    - by Mysterious
    Hello, I have a Table Machines that made of: ID = Identity , Primary , AutoIncrement,NOT NULL SN = Unique , String , NOT NULL Name =String now I am using a form to insert data into this table, and I am using BindingSource and ErrorProvider, I am handling Null and Empty string in the DataSet layer (partial class in the dataset.xsd), now when I try to end editing this.machinesBindingSource.EndEdit(); I got this error message: ex.Message = "Column 'SN' is constrained to be unique. Value '123' is already present." I know I entered a duplicated value but the question is HOW can I determine which the columnName that cause the error and re-write the error message entirely in different language I want to get the columnName and the wrong value thanks in advance

    Read the article

  • Change the style of WinForm border?

    - by Dodi300
    Is it possible to change the style of a WinForm border? I know that if the border is removed, it takes away the functionality to resize the program. Therefore is there a way to change the style of it? At the moment, I've removed the text from the border, set the "FormBorderStyle" to "SizableToolWindow" and set the "ControlBox" to false. That makes it look like this: But I want it to look something like this, but still be resizeable: (Maybe with a different color line)

    Read the article

  • How to get DataGridViewRow from CellFormatting event?

    - by tomaszs
    I have a DataGridView and handle event CellFormatting. It has a parameter called: DataGridViewCellFormattingEventArgs e With e.RowIndex in it. When i do: DataGridView.Rows[e.RowIndex] I get proper row from collection. But when I click at a header of a column to sort it by other column than default one and user DataGridView.Rows[e.RowIndex] I get unproper row. It is because Rows collection do not reflect order of rows in DataGridView. So how to get propert DataGridViewRow from RowIndex in DataGridView?

    Read the article

  • Of Datagridviews, databinding, and non validating cell values.

    - by Yanko Hernández Alvarez
    Lets simplify. Lets say I have this class: class T { public string Name { get; set; } public int Age { get; set; } public int height{ get; set; } ... } and I have a DataGridView's DataSource bound to a BindingList <T>, with N columns, each one bound to each property. I need to: Allow the user to enter non validating ages, heights, etc (for instance "aaa") Color the cells with non validating values (red background) Retain the non validating values displayed until the form is closed (I don't want to lose the values entered until the form is closed, so the user has the option to correct the bad cells anytime he wants BEFORE closing the form) Keep the last correct values entered for each cell with non validating values entered. When the form is closed, ditch the non validating values and keep the last correct values entered. Is there any easy way to do this?

    Read the article

  • c# control location precision

    - by AC
    I need more precision then integer based locations when puttng controls on a form. It seems control.location only supports Point. Is there a work around for this? Point p = new Point(100, 200); this.Location = p;// this works of course PointF pF = new PointF(100.04f, 200.08f); this.Location = pF;// this does not work of course because Location expects a Point not PointF Is there some setting on the base form, or base control I can set to have more location precision?

    Read the article

  • Iterating through tooltips

    - by icemanind
    Guys, I have a windows form with a panel control and inside the panel control are several other controls with a System.Windows.Forms.Tooltip attached to them. How can I iterate through each tooltip and set the Active property of the tooltip to false? Tooltips, unlike other controls, are not actually controls. So I had this: foreach (System.Windows.Forms.Control ctrl in this.pnlControl.Controls) { if (ctrl.Name.StartsWith("tt")) // since all my tooltip names start with 'tt' { System.Windows.Forms.ToolTip TipControl=(System.Windows.Forms.ToolTip)ctrl; TipControl.Active=false; } } This does not work though. It gets an error because the ToolTip control is not inherited from System.Windows.Forms.Control. Any ideas?

    Read the article

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

    - by Dodi300
    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 runpath = label2.Text; Process process; process = new Process(); process.EnableRaisingEvents = true; process.Exited += new System.EventHandler(process_Exited); process.StartInfo.FileName = @runpath; process.StartInfo.WorkingDirectory = @pathe; process.Start(); WindowState = FormWindowState.Minimized; } private void process_Exited(object sender, EventArgs e) { this.WindowState = FormWindowState.Normal; } It's meant to run a program and minimize, then return to the normal state once the program has closed. Although I get this error "Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on." Any idea how to get this to work? Thanks.

    Read the article

  • Fill Combo-box via DataSource Using Values from Various Columns

    - by peace
    Employee emp = new Employee(); comHandledBySQt.DataSource = emp.GetDataFromTable("1"); comHandledBySQt.DisplayMember = "FirstName"; The above code displays drop list of employees first names in a combo box. I want first name and last name to be displayed. How can i do it? I tried to include two columns FirstName and LastName as below but didn't work. comHandledBySQt.DisplayMember = "FirstName" + " " + "LastName"; Any help will be appreciated.

    Read the article

  • Using Application Settings and reading defaults from app.config

    - by Peter Goras
    Hi, I need to deploy a Windows Forms application using ClickOnce deployment. (VS2008, .NET 3.5) And I need to provide a configuration file for this app that any user can modify. For this reason, I am using Application Settings instead of standard appSetttings in app.config so I can separate the the user config from app config. see http://msdn.microsoft.com/en-us/library/ms228995(VS.80).aspx Creating a Settings.settings file using VS generated a class with hard-coded default values like this: [global::System.Configuration.DefaultSettingValueAttribute("blahblah")] public string MyProperty ... WTF? I want to read the default values from the app.config! So I created my own class deriving from ApplicationSettingsBase but I cannot get this to read values from the app.config. Any ideas?

    Read the article

  • C# WinForm Drawing - how to clear and redraw

    - by StoneHeart
    Here is screen shot of my game. On the left is my problem, seem "old draw" still existing. On the right is what it should be. http://img682.imageshack.us/img682/1058/38995989.jpg drawing code Graphics g = e.Graphics; for (int i = 1; i < 27; i += 1) { for (int j = 0; j < 18; j += 1) { ZPoint zp = zpoints[i, j]; if (zp != null) { g.DrawImage(zp.sprite_index, new Point(zp.x, zp.y)); Image arrow; if (zp.sprite_index == spr_green_zpoint) { arrow = spr_green_arrows[zp.image_index]; } else if (zp.sprite_index == spr_red_zpoint) { arrow = spr_red_arrows[zp.image_index]; } else { arrow = spr_grey_arrows[zp.image_index]; } g.DrawImage(arrow, new Point(zp.x - 4, zp.y - 4)); } } } if (latest_p1 != -1 && latest_p2 != -1) { ZPoint zp = zpoints[latest_p1, latest_p2]; if (zp != null) { g.DrawImage(spr_focus, new Point(zp.x - 6, zp.y - 6)); } }

    Read the article

  • Adding controls dynamically at design time vb.net

    - by chris
    I have been developing some custom smart tags. I am using a DesignerActionMethodItem which gets me to a fired method in code. When I try to hit the controls.Add the control is added but it seems the designer is unaware of it. It is never serialized and it goes away when the form is refreshed in the designer. Any help would be greatly appreciated. I am sort of stuck and google hasn't helped me. Please don't send me anything about smart tags that has nothing to do with adding controls dynamically at design time, I have already read so many looking for this.

    Read the article

  • When I try to show an image on linklabel click, I get an error

    - by JB
    When I try to show an image on linklabel click, I get an error: unrecognized escape sequence. Code: public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start( "mspaint~C:\Users\Joshua Banks\Desktop\Downtown_atlanta_night.jpg"); }

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >