Search Results

Search found 2806 results on 113 pages for 'winforms'.

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

  • How to use error provider at run time along with associating any control to validate

    - by Shantanu Gupta
    I am trying to create a Validation in a reusable fashion. Purpose: Make the validation control reusable. Error Provider should associate with control passed dynamically and can be set or cleared at run time. When user press OnClick event then all the controls gets validated with their own Error Providers. public bool IsFieldEmpty(ref TextBox txtControl, Boolean SetErrorProvider,string msgToShowOnError) { ErrorProvider EP = new ErrorProvider(); if (txtControl.Text == string.Empty) { if(SetErrorProvider==true) EP.SetError(txtControl, msgToShowOnError); return true; } else { if(SetErrorProvider==true) EP.Clear(); return false; } } Issue: Every time the function is called new errorprovider object gets created which i dont want. Every control should not have more than 1 error provider and i should be able to search it just like as done in asp.net to search for some control on a Page. How can I do this

    Read the article

  • What format do I use to store a relatively small amount of user data

    - by wcm
    I am writing a small program for our local high school (pro bono). The program has an interface allows the user to enter school holidays. This is a simple stand alone Windows app. What format should I use to store the data? A big relational data is obviously overkill. My initial plan was to store the data in an XML file. Co-workers have been suggesting that I use JSON files, Access Databases, SQL Lite, and SQL Server Express. There was even a suggestion of old school INI files.

    Read the article

  • Growing user control not updating

    - by user328259
    I am developing in C# and .Net 2.0. I have a user control that draws cells (columnar) depending upon the maximum number of cells. There are some drawing routines that generate the necessary cells. There is a property NumberOfCells that adjust the height of this control; CELLHEIGHT_CONSTANT * NumberOfCells. The OnPaint() method is overridden (code that draws the Number of cells). There is another user control that contains a panel which contains the userControl1 from above. There is a property NumberCells that changes userControl1's NumberOfCells. UserControl2 is then placed on a windows form. On that form there is a NumericUpDown control (only increments from 1). When the user increments by 1, I adjust the VerticalScroll.Maximum by 1 as well. Everything works well and good BUT when I increment once, the panel updates fine (inserts a vertical scrolll when necessary) but cells are not being added! I've tried Invalidating on userControl2 AND on the form but nothing seems to draw the newly added cells. Any assistance is appreciated. Thank you in advance. Lawrence

    Read the article

  • How can I receive mouse events when a wrapped control has set capture?

    - by Greg
    My WndProc isn't seeing mouse-up notifications when I click with a modifier key (shift or control) pressed. I see them without the modifier key, and I see mouse-down notifications with the modifier keys. I'm trying to track user actions in a component I didn't write, so I'm using the Windows Forms NativeWindow wrapper (wrapping the component) to get Windows messages from the WndProc() method. I've tried tracking the notifications I do get, and I the only clue I see is WM_CAPTURECHANGED. I've tried calling SetCapture when I receive the WM_LBUTTONDOWN message, but it doesn't help. Without modifier (skipping paint, timer and NCHITTEST messages): WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR WM_MOUSEMOVE WM_SETCURSOR WM_LBUTTONUP With modifier (skipping paint, timer and NCHITTEST messages): WM_KEYDOWN WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR (repeats) WM_KEYDOWN (repeats) WM_KEYUP If I hold the mouse button down for a long time, I can usually get a WM_LBUTTONUP notification, but it should be possible to make it more responsive.. Edit: I've tried control-clicking outside of the component of interest and moving the cursor into it before releasing the mouse button, and then I do get a WM_LBUTTONUP notification, so it looks like the component is capturing the mouse on mouse-down. Is there any way to receive that notification when another window has captured the mouse? Thanks.

    Read the article

  • C# async callback on disposed form

    - by Rodney Burton
    Quick question: One of my forms in my winform app (c#) makes an async call to a WCF service to get some data. If the form happens to close before the callback happens, it crashes with an error about accessing a disposed object. What's the correct way to check/handle this situation? The error happens on the Invoke call to the method to update my form, but I can't drill down to the inner exception because it says the code has been optimized. The Code: public void RequestUserPhoto(int userID) { WCF.Service.BeginGetUserPhoto(userID, new AsyncCallback(GetUserPhotoCB), userID); } public void GetUserPhotoCB(IAsyncResult result) { var photo = WCF.Service.EndGetUserPhoto(result); int userID = (int)result.AsyncState; UpdateUserPhoto(userID, photo); } public delegate void UpdateUserPhotoDelegate(int userID, Binary photo); public void UpdateUserPhoto(int userID, Binary photo) { if (InvokeRequired) { var d = new UpdateUserPhotoDelegate(UpdateUserPhoto); Invoke(d, new object[] { userID, photo }); } else { if (photo != null) { var ms = new MemoryStream(photo.ToArray()); var bmp = new System.Drawing.Bitmap(ms); if (userID == theForm.AuthUserID) { pbMyPhoto.BackgroundImage = bmp; } else { pbPhoto.BackgroundImage = bmp; } } } }

    Read the article

  • What causes my borderless C++ app to crash when overriding WndProc?

    - by Ste
    I use a form with border NONE. I need to override WndProc for resize and move form. However, using this code, my app crashes! static const int WM_NCHITTEST = 0x0084; static const int HTCLIENT = 1; static const int HTCAPTION = 2; protected: virtual void Form1::WndProc(System::Windows::Forms::Message %m) override { switch (m.Msg) { case WM_NCHITTEST: if (m.Result == IntPtr(HTCLIENT)) { m.Result = IntPtr(HTCAPTION); } break; } Form1::WndProc(m); } virtual System::Windows::Forms::CreateParams^ get() override { System::Windows::Forms::CreateParams^ cp = __super::CreateParams; cp->Style |= 0x40000; return cp; } How can I fix my code not to crash but still allow my form to be moved and resized?

    Read the article

  • AutoScaleMode.Inherit does not inherit

    - by codymanix
    I have a user control contained in a tabpage. The Form has set AutoScaleMode = AutoScaleMode.Font and the UserControl has set AutoScaleMode.Inherit. Now when I enlarge the font size of the form then the font is enlarged in the user control too, but the controls contents are not scaled. If I explicitly set AutoScaleMode.Font on the user control then it works properly. Shouldn't AutoScaleMode.Inherit work that way?

    Read the article

  • DataGridView with row-specific DataGridViewComboBoxColumn contents in C# Windows Forms 3.5

    - by XXXXX
    So I have something like the following data structure (constructors omitted) class Child { public string Name { get; set; } public int Age { get; set; } } class Parent { public string Name { get; set; } public List <Child> Children { get; private set; } // never null; list never empty public Child FavoriteChild { get; set; } // never null; always a reference to a Child in Children } List < Parent > Parents; What I want to do is show a DataGridView where each row is a Parent from Parent list. Each row should have two columns: a text box showing the parent's name and a DataGridViewComboBoxColumn containing that parent's children, from which the user can select the parent's favorite child. I suppose I could do the whole thing manually, but I'd like to do all this with more-or-less standard Data Binding. It's easy enough to bind the DataGridView to the list of parents, and easy enough to bind the selected child to the FavoriteChild property. The part that's giving me difficulty is that it looks like the Combo Box column wants to bind to one data source for all the combo-box's contents on all rows. I'd like each instance of the combo box to bind to the list of each parent's children. I'm fairly new to C#/Windows Forms, so I may well be missing something obvious. Or it could be that "you can't get there from here." It's not too tough to make a separate list of all the children and filter it by parent; I'm looking into that possibility right now. Is this feasible, or is there a better way?

    Read the article

  • How to get characters read from the keyboard?

    - by Sandy
    Hi, I am trying to get the characters read from the keyboard. I have the following list of that I wish to recognize if entered by a user. List of keyboard entries: letters [ ] ~ ^ numbers Part of the code: void HookManager_KeyUp(object sender, KeyEventArgs e) { string test = e.KeyCode.ToString(); Here numbers, letters and square brackets work correctly but the ~ and ^ which require shift key is read incorrectly. For eg. it reads ^ which is on key 6 as a value of 6 and not ^ as it should be. Any help would be appreciated. Thanks AA

    Read the article

  • How to allow user to set expressions detrmining property value in PropertyGrid

    - by savras
    I noticed that programs like Report Builder allow user to set property value or an expression determining property value. I want to the add same functionality to my application. So is there any simple way to do so or do i have to redefine all type converters so that they allow to set expression in addition to their original functionality. http://img204.imageshack.us/img204/7934/48707358.jpg

    Read the article

  • VB.NET Winform & UltraTree ?

    - by bochur1
    Can someone tell me how I can binding an Ultratree to a Bindingsource? Binding it to a dataset won't work for me since I need to be able to do filters on the data, something I have in the BindingSource but not in the Dataset.

    Read the article

  • How to parse date from html page using html agility pack ?

    - by Harikrishna
    I have html pages and I am parsing those pages with html agility pack. Now I want to parse some information.In every pages there is trading date(20/02/02) which I want to parse. Like it will be look like a Trading date : 20/02/02. Now Trading date and date(20/02/02) may be in same column(td) or it can be different column like in first column trading date and in second column 20/02/02 then what should I do ?

    Read the article

  • Where to maintain common information, that could be accessed by all forms

    - by The King
    Hi All, This is my first winform app in .NET... I have made a couple of ASP.NET app... In this app, I have some common variables, like current user name, his selected process etc.. etc.. This should be made accessible from all forms in the app at any time... How could I do this... Is there any place like "Session" in ASP.NET here... Further How do coders generally pass information from one form to another... Here I want to pass on the info I acquired in the first form to the subsequent forms... I use constructor overloading and pass the values as parameters... I'm pretty sure there has to be a better way to do it... Thanks for your time...

    Read the article

  • problem with converting simple code to silverlight app.

    - by Sara
    Hi. I have this code for window form application and I have been attempting to convert it to a Silverlight application but it does not work!. There is a Textbox and I attached KeyDown event handler to it. when the user press the arrow key ( left or right) while the focus on the textbox, it will write . or -. When it is window form i used e.KeyCode and Keys.Right and its works great but when it is silverlight I used e.Key and key.Right and the program doesn't work good because the arrows do the 2 functions moving and write ./-. How I can work this out in Silverlight? (My English not good) The code ( window form): private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (sender is TextBox) { TextBox textBox = (TextBox)sender; if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { e.Handled = true; char insert; if (e.KeyCode == Keys.Left) { insert = '.'; } else { insert = '-'; } int i = textBox.SelectionStart; textBox.Text = textBox.Text.Insert(i, insert.ToString()); textBox.Select(i + 1, 0); } } } (and Silverlight): private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (sender is TextBox) { TextBox textBox = (TextBox)sender; if (e.Key == Key.Left || e.Key == Key.Right) { e.Handled = true; char insert; if (e.Key == Key.Left) { insert = '.'; } else { insert = '-'; } int i = textBox.SelectionStart; textBox.Text = textBox.Text.Insert(i, insert.ToString()); textBox.Select(i + 1, 0); } } } I don't understand, is there huge different effect between using Keycode/Keys and Key/Key or because something else?

    Read the article

  • Accessing form's resources (resx file) from code

    - by kzen
    If I have a form Frm1.cs that is using some icons, images or other resources, these resources get stored in the form's resx file (Frm1.resx). My simple question is how do I access these resources from code? As a workaround I can store these resources in the Project resource file and they will be available via Properties.Resources.resourcename. However, similar syntax does not work for the resources stored in the form's resource file. While searching for a solution I have come across several references to ResourceManager class but was not able to find a way to use that to access the form's resources...

    Read the article

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