Search Results

Search found 45324 results on 1813 pages for 'web to winforms'.

Page 18/1813 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Cross-thread Winforms control editing

    - by Motig
    Hey, how can I edit the text in a windows form element if the code that is editing the text 'belongs' to a seperate thread from the one that contains the windows form? I get the exception: Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on. Thank you.

    Read the article

  • Winforms Controlling Forms

    - by jack london
    How can i control all my forms from main () static void Main() { Form1 frm1 = new Form1(); Form1 frm2 = new Form1(); Form1 frm3 = new Form1(); frm1.Show(); while (frm1.Button.Clicked) { frm2.Show(); frm3.Show(); } } form.ShowDialog () helps much but the execution stack can overflow. Form.Show and Form.Hide methods runs when an application class has been set. In Application.Run (Form) way there's always a main form. and i dont want this one. Any other approach you use in this problem

    Read the article

  • Reset custom region in winforms using C#

    - by Suriyan Suresh
    i have removed left portion of a form using graphics path and region command. when i am trying to show group box on removed portion, group box not appeared. how do i show the groupbox on removed region area ?. or how do i reset the region GraphicsPath shape = new GraphicsPath(); shape.AddRectangle(new Rectangle(200, 0, FormWidth, FormHeight)); this.Region = new Region(shape);

    Read the article

  • Bring Winforms control to front

    - by Nathan
    Are there any other methods of bringing a control to the front other than control.BringToFront()? I have series of labels on a user control and when I try to bring one of them to front it is not working. I have even looped through all the controls and sent them all the back except for the one I am interested in and it doesn't change a thing. Here is the method where a label is added to the user control private void AddUserLabel() { UserLabel field = new UserLabel(); ++fieldNumber; field.Name = "field" + fieldNumber.ToString(); field.Top = field.FieldTop + fieldNumber; field.Left = field.FieldLeft + fieldNumber; field.Height = field.FieldHeight; field.Width = field.FieldWidth; field.RotationAngle = field.FieldRotation; field.Barcode = field.BarCoded; field.HumanReadable = field.HumanReadable; field.Text = field.FieldText; field.ForeColor = Color.Black; field.MouseDown += new MouseEventHandler(label_MouseDown); field.MouseUp += new MouseEventHandler(label_MouseUp); field.MouseMove += new MouseEventHandler(label_MouseMove); userContainer.Controls.Add(field); SendLabelsToBack(); //Send All labels to back userContainer.Controls[field.FieldName].BringToFront(); } Here is the method that sends all of them to the back. private void SendLabelsToBack() { foreach (UserLabel lbl in userContainer.Controls) { lbl.SendToBack(); } }

    Read the article

  • Adding & Removing Dynamic Controls in C# WinForms.

    - by gsvirdi
    I have three Tabs in my WinForm; depending on the selected RaioButton in the TabPages[0] I added few dynamic controls on the relevant TabPage. On Button_Click event the controls are added, but the prob is the I'm not able to remove the Dynamically added controls from the other (irrelevant) TabPage. Here's my code: Label label235 = new Label(); TextBox tbMax = new TextBox(); label235.Name = "label235"; tbMax.Name = "txtBoxNoiseMax"; label235.Text = "Noise"; tbMax.ReadOnly = true; label235.ForeColor = System.Drawing.Color.Blue; tbMax.BackColor = System.Drawing.Color.White; label235.Size = new Size(74, 13); tbMax.Size = new Size(85, 20); if (radioButton1.Checked) { label235.Location = new Point(8, 476); tbMax.Location = new Point(138, 473); tabControl.TabPages[1].Controls.Add(label235); tabControl.TabPages[1].Controls.Add(tbMax); tabControl.TabPages[2].Controls.RemoveByKey("label235"); tabControl.TabPages[2].Controls.RemoveByKey("tbMax"); } else { label235.Location = new Point(8, 538); tbMax.Location = new Point(138, 535); tabControl.TabPages[1].Controls.RemoveByKey("label235"); tabControl.TabPages[1].Controls.RemoveByKey("tbMax"); tabControl.TabPages[2].Controls.Add(label235); tabControl.TabPages[2].Controls.Add(tbMax); } Where am I making that mistake?????

    Read the article

  • Winforms, creating padding when using Dock properties.

    - by Zka
    How do I add padding, or some space between the textboxes when using dockstyle.top property? for(int i =0; i< 10; i++) { textboxes[i] = new TextBox(); textboxes[i].Dock = DockStyle.Top; mypanel.Controls.Add(textboxes[i]); } The code above puts textboxes right beneath each other. Can't figure this out without using mass panels or fixed positioning. How to do the following? 1) I would like to add around 10-20pixels between boxes. 2) How to change size (height,width) of the textboxes, since when using dockstyle.top it ignores the size commands ?

    Read the article

  • Problems when using IconAlignment with WinForms ErrorProvider

    - by Irina
    Hi, I have a ComboBox that has an associated ErrorProvider in the user control it belongs to. When an error happens, I want to display an icon on the left of the combo. However, no matter what value I set as IconAlignment for my combo, the icon gets displayed on the right. Do you guys have any idea what could be wrong here? Thanks for any help.

    Read the article

  • Whats the KeyCode for overwriting a text in TextBox in winforms

    - by Ragha J
    I have a custom control which extends from TextBox. In the KeyDown event of the control I have access to the KeyCode property of keyEventArgs If the text in the textbox is selected and some other text is typed on top of it, the keyCodes that I am getting in the KeyDown event are different each time and in the KeyPress event I get the actual value. For ex: If the textbox has value 1234 and now I select 1234 and type 5 on top of it, I want to to be able to know in any of the events by some key combination that the old value 1234 is gone and the new value of the textbox is 5.

    Read the article

  • WinForms prints to default printer even if it's not available/connected

    - by Valentein
    How can I determine if printer is connected? Typically this application prints to the default printer but in some cases that printer may not be available. If so I don't want the job sent to it's queue but rather printed to another available printer. I understand the PinterSettings.InstalledPrinters property. Does PrintDocument.PrinterSettings.IsValid return false if a printer is not available? Does WPF provide this kind of functionality? My problem is different than Printing problem in C# windows app - Always prints to default printer

    Read the article

  • C# WinForms & SQL bindings

    - by vent
    I have a MSSQL database with many tables and relations. I want to bind it to my C# GUI application with text- and combo-boxes. Which one is the best way to do it: (1) Everything done manually by own classes and methods: Import data to dataset or to many datatables separately, then create dictionaries to comboboxes, manually retrieve data to textboxes and create a sql statement if update action will be invoked, or, (2) Done automatically by VS: Connect my controls with BindingSource and BindingNavigator if needed. I know how to deal with the first one, but if the second way would be better, my question is — how to achieve it? I haven't dealt with automatically created databindings and I don't know how to tell to DataBinding property (Key|Value|Text) about relations and current row's ID. And what is the method to cancel/update changes in all GUI elements? I need a simple solution for this scenario. It's a quick-and-dirty academical project, which must only "work" and be as fast implemented as it can. Thanks

    Read the article

  • Winforms: Embedded NumericUpDown control inside ListView

    - by tanthiamhuat
    say in my ListView say with 4 columns (Description, Price Per Unit, Quantity, Total Price). I would like to make the third column editable, and embedded NumericUpDown control for the Quantity column. Is it possible? And when the Quantity is updated via the NumericUpDown control, the Total Price is also being updated based on Total Price = Quantity * Price Per Unit. is the above achievable? any code samples would be greatly appreciated.

    Read the article

  • Change color of text within a WinForms RichTextBox

    - by Addie
    I have a RichTextBox that I write a string to every time I click a Form button. The string ends with a newline so each time I add a string, it appends to the bottom of the RichTextBox. Each string begins with the string "Long" or "Short" and ends with Environment.NewLine. I'd like to color each line red if it beings with "Long" and blue if it begins with "Short". How can I do this? If you need further clarification of the question comment below.

    Read the article

  • Winforms: Enabling Localization by default (enforcing a project/solution policy)

    - by Obalix
    Is there an easy way to set the Localizable property to true for newly created usercontrols / forms? The scope of the setting should ideally be a solution or a project. In other words I want to say that this project/solution should be localizable, and then if I add a new form or control VS should automatically set the property to true. Edit: Although custom templates are possible, in a larger team they might not be always used. So it's more about enforcing a policy, ensuring that the team members do not ommit to set the property for the projects/solutions where it is a requirement that all forms/controls containing text resources should be localizable. Note: Team Foundation Server is not an Option.

    Read the article

  • [C#, WinForms] Handle that Shift+F10 w(h)as pressed

    - by Alexander Stalt
    I want to use the exclusive key to open context menu that are available in most of the new laptops and keyboards. This key is usually available between right ALT and CTRL key. I am not sure that it is always equivalent to "Shift + F10" ( or is it always equivalent to "Shift+F10" ?). My programs runs on Windows XP and earlier versions. Context menu should appear at mouse cursor position (if it's possible).

    Read the article

  • Embedding a File Explorer instance in a WinForms app form

    - by Unsliced
    My (C#, .NET 3.5) app generates files and, in addition to raising events that can be caught and reacted to, I want to display the target folder to the user in a form. The file-list is being shown within the same form as other information. I'm using an instance of the WebBrowser control (System.Windows.Forms.WebBrowser), then navigating to the folder. This shows some default view of the explorer window, with the file summary panel on the left and the files in the 'Tiles' (large icon and text) view. e.g. wb.Navigate(@"c:\path\to\folder\"); I'd like to suppress the panel and to view the file list in the Details view. The user can get to this via a right-click, context menu, but I'd like it to come up automatically. I'd rather not have to build my own TreeView, DataGridView or whatever; the WebBrowser control does all the updating and re-sorting and whatnot 'for free'. Does anybody have a better suggestion? A different control to use or some additional arguments to pass to the control? And if I could trap events (e.g. files being selected/renamed/double-clicked, etc.) then all the better!

    Read the article

  • WinForms button position - not aligned as it should

    - by Zka
    Adding some gui modifications and I want to have a button which is 10pixels away from the forms left and right border. With this code the right border of the button is around 20-30 pixel outside the form window. Why is that? How can I position my button to be exactly 10pixels away from the form borders ? int margin = 10; meny1 = new Button(); meny1.Top = 50; meny1.Left = margin; meny1.Size = new Size(this.Width - (2*margin), 30);

    Read the article

  • winforms settings

    - by snorlaks
    Hello, I would like to ask what is the best way to implement functionality that: User has for example 3 buttons on the main form, if he clicks on any button the form is replaced with another one where he has to fill some textcontrolls and after clicking accept redirect him to the main form. Is it done by using visible and swithing it ? I hope there is much cleaner solution thanks for help, bye

    Read the article

  • C# winforms: graphics.DrawImage problem

    - by Tony
    Hi, I have a really strange problem with Graphics.DrawImage method. I have the PictureBox control in the Panel control with AllowScroll property = true. The program cuts the image on small parts basing on the area selected by the user. I load the image 300x547 and select the area (the red rectangle): program properly cuts the image: then, I load another image 427x640: and then, as the result I see that the image is not cut properly. Each img.jpg file has properly width & height but the drawn image is too small: here's the code snippet - it saves the bitmap area selected by the user: Bitmap bmp = new Bitmap(selectedAreaRECT.Width, selectedAreaRECT.Height); Graphics g = Graphics.FromImage(bmp); g.DrawImage(OriginalIMG, 0,0, selectedAreaRECT, GraphicsUnit.Pixel); g.Save(); g.Dispose(); bmp.Save(AppDomain.CurrentDomain.BaseDirectory + @"\Temp\" + "img1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); As You see, the code is the same for the img1.jpg from image A and from Image B. I'm trying to resolve that stupid problem for too long, I don't know what's the reason of that problem. I tried diffrent constructors of the DrawImage method, with no success

    Read the article

  • WinForms Application Form "Shakes" When Audio Playing

    - by ikurtz
    I have a C# game program that i'm developing. it uses sound samples and winsock. when i test run the game most of the audio works fine but from time to time if it is multiple samples being played sequentially the application form shakes a little bit and then goes back to its old position. how do i go about debugging this or present it to you folks in a manageable manner? i'm sure no one is going to want the whole app code in fear of virus attacks. please guide me.. EDIT: i have not been able to pin down any code section that produces this result. it just does and i cannot explain it. EDIT: no the x/y position are not changing. the window like shakes around a few pixels and then goes back to the position were it was before the shake. if (audio) { Stream stream; SoundPlayer player; stream = Properties.Resources.ResourceManager.GetStream("_home"); player = new System.Media.SoundPlayer(stream); player.PlaySync(); player.Dispose(); string ShipID = fireResult.DestroyedShipType.ToString(); stream = Properties.Resources.ResourceManager.GetStream("_" + ShipID); player = new System.Media.SoundPlayer(stream); player.PlaySync(); player.Dispose(); stream = Properties.Resources.ResourceManager.GetStream("_destroyed"); player = new System.Media.SoundPlayer(stream); player.PlaySync(); player.Dispose(); } can you see anything in the above code that would produce this shake?

    Read the article

  • Passing data to Winforms UI using BeginInvoke

    - by Bi
    I am a C# newbie and have a class that needs to pass row information to a grid in the windows form. What is the best way to do it? I have put in some example code for better understanding. public class GUIController { private My_Main myWindow; public GUIController( My_Main window ) { myWindow = window; } public void UpdateProducts( List<myProduct> newList ) { object[] row = new object[3]; foreach (myProduct product in newList) { row[0] = product.Name; row[1] = product.Status; row[2] = product.Day; //HOW DO I USE BeginInvoke HERE? } } } And the form class below: public class My_Main : Form { //HOW DO I GO ABOUT USING THIS DELEGATE? public delegate void ProductDelegate( string[] row ); public static My_Main theWindow = null; static void Main( ) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); theWindow = new My_Main(); Application.Run(theWindow); } private void My_Main_Load( object sender, EventArgs e ) { /// Create GUIController and pass the window object gui = new GUIController( this ); } public void PopulateGrid( string[] row ) { ProductsGrid.Rows.Add(row); ProductsGrid.Update(); } }

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >