Search Results

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

Page 44/113 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • Can you change VS Win Forms designer code generation?

    - by Big Endian
    We implemented new standards, which call for our private members to have a leading underscore. Like so: private System.Windows.Forms.Label _label; Unfortunately VS will put out the default below when you drag a new label onto your form: private System.Windows.Forms.Label label1; Is there a way to change that to: private System.Windows.Forms.Label _label1; Cheers, Plamen

    Read the article

  • String Matching.

    - by Harikrishna
    I have a string String mainString="///BUY/SELL///ORDERTIME///RT///QTY///BROKERAGE///NETRATE///AMOUNTRS///RATE///SCNM///"; Now I have another strings String str1= "RT"; which should be matched only with RT which is substring of string mainString but not with ORDERTIME which is also substring of string mainString. String str2= "RATE" ; And RATE(str2) should be matched with RATE which is substring of string mainString but not with NETRATE which is also substring of string mainString. How can we do that ?

    Read the article

  • How to retarget the scroll wheel in VB.Net?

    - by Orborde
    I have a form in VB.Net with Autoscroll enabled and several ComboBoxes within it. When I click on a ComboBox, I can use the mouse wheel to scroll through options, but I cannot deselect the ComboBox (by clicking off it on a blank portion of the parent form) in order to return to scrolling the parent form. This makes navigation in the form annoying, as I instinctively click off the control and flip the scroll wheel, causing the ComboBox to change selections instead of moving the parent form. Is there a way to make this work in the intuitive way I expect it to, or do I have some conceptual confusion that makes this the wrong question to ask?

    Read the article

  • I am using a constructor for my array but why is it saying i need a return type?

    - by JB
    using System; using System.IO; using System.Data; using System.Text; using System.Drawing; using System.Data.OleDb; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Drawing.Printing; using System.Collections.Generic; namespace Eagle_Eye_Class_Finder { public class GetSchedule { public class IDnumber { public string Name { get; set; } public string ID { get; set; } public string year { get; set; } public string class1 { get; set; } public string class2 { get; set; } public string class3 { get; set; } public string class4 { get; set; } IDnumber[] IDnumbers = new IDnumber[3]; public GetSchedule() //here i get an error saying method must have a return type??? { IDnumbers[0] = new IDnumber() { Name = "Joshua Banks",ID = "900456317", year = "Senior", class1 = "TEET 4090", class2 = "TEET 3020", class3 = "TEET 3090", class4 = "TEET 4290" }; IDnumbers[1] = new IDnumber() { Name = "Sean Ward", ID = "900456318", year = "Junior", class1 = "ENGNR 4090", class2 = "ENGNR 3020", class3 = "ENGNR 3090", class4 = "ENGNR 4290" }; IDnumbers[2] = new IDnumber() { Name = "Terrell Johnson",ID = "900456319",year = "Sophomore", class1 = "BUS 4090", class2 = "BUS 3020", class3 = "BUS 3090", class4 = "BUS 4290" }; } static void ProcessNumber(IDnumber myNum) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1); myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); MessageBox.Show(myData); } public string GetDataFromNumber(string ID) { foreach (IDnumber idCandidateMatch in IDnumbers) { if (IDCandidateMatch.ID == ID) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1); myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); return myData; } } return ""; } } } }

    Read the article

  • What's wrong with my cross-thread call in Windows Forms?

    - by MainMa
    Hi, I encounter a problem with a Windows Forms application. A form must be displayed from another thread. So in the form class, I have the following code: private delegate void DisplayDialogCallback(); public void DisplayDialog() { if (this.InvokeRequired) { this.Invoke(new DisplayDialogCallback(DisplayDialog)); } else { this.ShowDialog(); } } Now, every time I run this, an InvalidOperationException is thrown on the line this.ShowDialog();: "Cross-thread operation not valid: Control 'SampleForm' accessed from a thread other than the thread it was created on." What's wrong with this piece of code? Isn't it a valid way to make cross-thread calls? Is there something special with ShowDialog()?

    Read the article

  • System.Windows.Forms.DataVisualization Namespace Fine in One Class but Not in Another

    - by jxpx777
    Hi. I'm getting this error The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?) Here is my using section of the class: using System; using System.Collections; using System.Collections.Generic; using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting.Borders3D; using System.Windows.Forms.DataVisualization.Charting.ChartTypes; using System.Windows.Forms.DataVisualization.Charting.Data; using System.Windows.Forms.DataVisualization.Charting.Formulas; using System.Windows.Forms.DataVisualization.Charting.Utilities; namespace myNamespace { public class myClass { // Usual class stuff } } The thing is that I am using the same DataVisualization includes in another class. The only thing that I can think that is different is that the classes that are giving this missing namespace error are Solution Items rather than specific to a project. The projects reference them by link. Anyone have thoughts on what the problem is? I've installed the chart component, .Net 3.5 SP1, and the Chart Add-in for Visual Studio 2008. UPDATE: I moved the items from Solution Items to be regular members of my project and I'm still seeing the same behavior. UPDATE 2: Removing the items from the Solution Items and placing them under my project worked. Another project was still referencing the files which is why I didn't think it worked previously. I'm still curious, though, why I couldn't use the namespace when the classes were Solution Items but moving them underneath a project (with no modifications, mind you) instantly made them recognizable. :\

    Read the article

  • C# ErrorProvider Want to know if any are Active

    - by RcK
    I want to know if any ErrorProvider are active in my form. being able to find this out might help reduce my code.. I did find this thing here Counting ErrorProvider but incase someone knows a better way... so here goes. Ok so basically I have a WinForm which has many TextBoxes Now when user enters values I use Validating to perform validation and if it does not match Regex I set the ErrorProvider ON for that Control.. similarly if the user changes the value to a acceptable one I switch ErrorProvider OFF for that Control.. but when SAVE is clicked i have to do another check anyways incase the user did not listen to me and change the thing like he was supposed to and still clicked SAVE.. I dont want the thing crashing.. soo mm is there like a thing where I could say if ErrorProviders is not active then proceed with save else message box saying change it. [ANOTHER QUESTION] Umm When Validating it only Validates when the Control loses Focus... I kinda of want it to do validation when user stops typing.. I hope you get what I mean Like Email Address(textbox) when user is typing his/her name in I [DON'T] want it to do validation yet, but when user has finished entering is waiting for ErrorProvider to disappear(But it doesn't coz it only does that when control loses focus) 2 odd seconds after typing can i make the validation take place?

    Read the article

  • [C#][XNA 3.1] How can I host two different XNA windows inside one Windows Form?

    - by secutos
    I am making a Map Editor for a 2D tile-based game. I would like to host two XNA controls inside the Windows Form - the first to render the map; the second to render the tileset. I used the code here to make the XNA control host inside the Windows Form. This all works very well - as long as there is only one XNA control inside the Windows Form. But I need two - one for the map; the second for the tileset. How can I run two XNA controls inside the Windows Form? While googling, I came across the terms "swap chain" and "multiple viewports", but I can't understand them and would appreciate support. Just as a side note, I know the XNA control example was designed so that even if you ran 100 XNA controls, they would all share the same GraphicsDevice - essentially, all 100 XNA controls would share the same screen. I tried modifying the code to instantiate a new GraphicsDevice for each XNA control, but the rest of the code doesn't work. The code is a bit long to post, so I won't post it unless someone needs it to be able to help me. Thanks in advance.

    Read the article

  • Cannot change the Label text!

    - by BDotA
    I have created a custom control and added a label property to it so at design time we can pick a Label and assign it to that control. so basically I want that if a label is assigned to that control, its text should change as below and also its text should change to bold font, so here is that code: private Label assignedLabel; public Label AssignedLabel { get { return assignedLabel; } set { assignedLabel = value; assignedLabel.Text = @"*" + assignedLabel.Text; assignedLabel.Font = new Font(AssignedLabel.Font, FontStyle.Bold); AssignedLabel.Refresh(); } } the problem is that based on the code above the Font of that assigned label is correctly changing to Bold font, but its Text is not taking affect. why is that happening? how can I fix this issue?

    Read the article

  • dynamically created datagridview columns not accessible unless added to a form...why?

    - by deostroll
    We simply created a DataGridView control dynamically and bound it to a DataTable. We were tying to style certain columns. But, when we tried to access the columns we got a null reference. On further investigation we found that if we add the DataGridView control to the main form, and then try to access its columns, it works fine!!! Code which throws error: DataGridView gv = new DataGridView(); gv.DataSource = GetDataTable(); //binding it to datatable Debug.Assert(gv.Columns == null); Code which works fine: DataGridView gv = new DataGridView(); gv.DataSource = GetDataTable(); //binding it to datatable this.Controls.Add(gv); //adding to form Debug.Assert(gv.Columns == null); //the assertion fails! Why is this behaviour so? Is there a workaround for this?

    Read the article

  • How to draw a rectangle in WinForm app in the correct location

    - by TooFat
    I have a WinForm app that has an image displayed in a PictureBox that has the added functionality of allowing a user to draw a rectangle on the image by clicking and dragging. The Location, Height and Width of the rectangle are saved to disk. When the image is viewed again I would like to automatically redraw that rectangle in the same position on the image. When I redraw it, however, the Height and Width are fine but the location is always off. The location is being captured in the MouseDown Event like so private void pbSample_MouseDown(object Sender, MouseEventArgs e) { if (SelectMode) { StartLocation.X = e.X; StartLocation.Y = e.Y; //later on these are saved as the location of the rectangle } } And I am redrawing it like so public void DrawSelectedArea(Rectangle rect) { Graphics g = this.PictureBox1.CreateGraphics(); Pen p = new Pen(Brushes.Black); g.DrawRectangle(p, rect); } Given the location from the MouseEventArgs captured during the MouseDown Event how can I calculate the correct location to redraw my rectangle?

    Read the article

  • How to create column of type password in gridview?

    - by Preeti
    Hi, I am creating an application in which user selects files and provides credentials to open that file. For that i have created three columns in a gridview. User enters password in password column. I want to display '*' in place of characters like we can create a textbox of password type. I have tried this code on 'GridView_CellClick' event : if (GridView.Columns[e.ColumnIndex].HeaderText == "Password") { txtPassword[e.RowIndex] = new TextBox(); txtPassword[e.RowIndex].Name = "txtPassword"+e.RowIndex; txtPassword[e.RowIndex].PasswordChar = '*'; txtPassword[e.RowIndex].Visible = true; txtPassword[e.RowIndex].TextChanged += new if (GridView.CurrentCell.Value == null) txtPassword[e.RowIndex].Text = ""; else txtPassword[e.RowIndex].Text = GridView.CurrentCell.Value.ToString(); txtPassword[e.RowIndex].Location = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Location; txtPassword[e.RowIndex].Size = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Size; txtPassword[e.RowIndex].Visible = true; txtPassword[e.RowIndex].Focus(); } But in above solution characters are displayed. How can i solve this problem???

    Read the article

  • Visual C# | Capturing data from a window in a closed-source third-party Win32 application

    - by Zach Albia
    I'm planning on creating a C# Windows Forms app as an extension for a third-party Win32 application but I'm stumped as to how to do this right now. The farthest I've gotten is knowing it involves Win32 Hooking and that there's this open source project called EasyHook that's supposed to allow me to do this. I'd like to know how I can get the text from a textbox or some other data from a control in a third-party Win32 application. The text/data in a control is to be captured from the external application's running window the moment the user presses a button. I guess the question can be summed up as follows: How do you determine the event to hook to when the user clicks a certain button? How do you get the value displayed by a Win32 control at the time the button is clicked?

    Read the article

  • Problem with image path of html files viewed by webbrowser control

    - by Royson
    I have an webbrowser control on my form. I am able display html files in that control. But my page contains some images if i give absolute path to it then images are displayed. But if i give relative path then images are not shown in the pages. I have HtmlPages folder located at bin folder. And i am assigning FileStream source = new FileStream(@"..\HtmlPages\supportHtml.html", FileMode.Open, FileAccess.Read); webBrowser.DocumentStream = source; If i assign D:\myapp\bin\HtmlPages\file.png then there is no problem. My images are stored in same folder. If i open html files with webbrowser then images are displayed. What is the correct path to set ??

    Read the article

  • How to program asynchronous Windows Forms Applications?

    - by Nestor
    I'm writting a Windows Forms application in C# that performs a lot of long-running procedures. I need to program the application so that the GUI doesn't lock. What is the best way to program it? I know how to use the following: BeginInvoke/EndInvoke Calling Application.DoEvents() repeatedly (probably not a good idea) BackgroundWorker etc. But how to manage GUI state with call backs, etc... is not trivial. Are there solutions for this (in the form of patterns or libraries)?

    Read the article

  • How to display static (shared) object's properties in a PropertyGrid?

    - by Paul Sasik
    I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this: _propertyGrid.SelectedObject = System.Windows.Forms.Application I get a compilation error: 'Application' is a type and cannot be used as an expression. Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?

    Read the article

  • How can we define more than one table,define columns and write data in xml file ?

    - by Harikrishna
    I am writing my xml file manually. And I am writing that for storing data and retrieving data from that. I have written file like for the table PersonalInfo. <?xml version="1.0" standalone="yes"?> <PersonalInfo> <xs:schema id="PersonalInfo" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="PersonalInfo" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="PesonalInfo."> <xs:complexType> <xs:sequence> <!--Define Column Here....--> <xs:element name="name" type="xs:string" /> <xs:element name="address" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <!--First Row--> <PersonalInfo.> <name>Harikrishna</name> <address>India</address> </PersonalInfo.> <!--Second Row--> <PersonalInfo.> <name>Jatin</name> <address>India</address> </PersonalInfo.> </PersonalInfo> Please suggest any mistake with writing file here. And now I want define more than table in this file. And here I have to write data for the table like <PersonalInfo.> <name>Harikrishna</name> <address>India</address> </PersonalInfo.> <PersonalInfo.> <name>Jatin</name> <address>India</address> </PersonalInfo.> Is not possible some thing writing data when defining columns EDIT : <xs:element name="name" type="xs:string",Harikrishna,Jatin.... /> <xs:element name="address" type="xs:string",India,India.... /> And how to define more than one table in a single xml file ?

    Read the article

  • Check SuspendLayout

    - by norlando02
    Is there a way in C# to check if an object is suspend? I have a TreeView that I need to know if it is still suspend. myTreeView.BeginUpdate(); myTreeView.SuspendLayout(); // Do Stuff. myTreeView.EndUpdate(); myTreeView.ResumeLayout(); Because i have this code in a recursive function I want to know if the TreeView is already been suspended.

    Read the article

  • Graphics.FromHwnd(IntPtr.Zero) returns null, why?

    - by Martin Moser
    I'm currently investigating a problem with a 3rd party component (DevExpress) in my application. My issue is quite similar to this one DevExpress KB article. I get the same exception with more less the same stacktrace. So I used .NET Reflector to find out, what may be null in this scenario, and the only object which is a candiate to be null is Graphics. This is created with Graphics.FromHwnd(IntPtr.Zero). Because I don't have a broad knowledge about GDI, I would like to know if somebody can tell me possible scenarios when this may return null... I tried to reproduce it in a scenario where windows is out of GDI handle's, but then I'm getting a "out of handles" - exception at least once, which is not the case in the issue I'm investigating tia, Martin

    Read the article

  • Problem with flash in a webbrowser in a winform

    - by fgnt
    I have the oddest problem (but aren't all programming problems odd?). I have a winform that contains a webbrowser object that opens a website that has flash on it. This winform is running on a touchscreen computer (I can't find the brand or model number). Here is what I know: flash objects embeded in a website that is accessed via the webbrowser object in my winform do not function properly said flash objects only react to the first 'click' on them. So the website opens and if I hit a button, that button works but nothing afterward works within the flash object works. If my first 'click' misses a button, nothing works there after. trying to 'click' an flash button gives the same response as just hovering over the button This isn't a problem with the touch part of the touch screen as using a mouse also gives the same not working right response this isn't a problem with the web page as I can open up explorer on the same computer and navigate the webpage just fine from there The program also works 100% right on my personal computer so it shouldn't be the program's fault if it's not the touch screen fault and not the program's fault, I can't blame anything right now. the EXACT same program worked 100% on our old touch screen (which was having other problems so we had to get rid of it). Oh, also, surfing just a 'normal' webpage in a webbrowser in the winform works just fine.

    Read the article

  • Windows Screensaver Multi Monitor Problem

    - by Bryan
    I have a simple screensaver that I've written, which has been deployed to all of our company's client PCs. As most of our PCs have dual monitors, I took care to ensure that the screensaver ran on both displays. This works fine, however on some systems, where the primary screen has been swapped (to the left monitor), the screensaver only works on the left (primary) screen. The offending code is below. Can anyone see anything I've done wrong, or a better way of handling this? For info, the context of "this", is the screensaver form itself. // Make form full screen and on top of all other forms int minY = 0; int maxY = 0; int maxX = 0; int minX = 0; foreach (Screen screen in Screen.AllScreens) { // Find the bounds of all screens attached to the system if (screen.Bounds.Left < minX) minX = screen.Bounds.Left; if (screen.Bounds.Width > maxX) maxX = screen.Bounds.Width; if (screen.Bounds.Bottom < minY) minY = screen.Bounds.Bottom; if (screen.Bounds.Height > maxY) maxY = screen.Bounds.Height; } // Set the location and size of the form, so that it // fills the bounds of all screens attached to the system Location = new Point(minX, minY); Height = maxY - minY; Width = maxX - minX; Cursor.Hide(); TopMost = true;

    Read the article

  • Why does my call to Activator.CreateInstance intermittently fail?

    - by Daniel Stutzbach
    I'm using the following code to access the Windows Explorer Shell's band site service: Guid GUID_TrayBandSiteService = new Guid(0xF60AD0A0, 0xE5E1, 0x45cb, 0xB5, 0x1A, 0xE1, 0x5B, 0x9F, 0x8B, 0x29, 0x34); Type shellTrayBandSiteService = Type.GetTypeFromCLSID(GUID_TrayBandSiteService, true); site = Activator.CreateInstance(shellTrayBandSiteService) as IBandSite; Mostly, it works great. A very small percentage of the time (less than 1%), the call to Activator.CreateInstance throws the following exception: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {F60AD0A0-E5E1-45CB-B51A-E15B9F8B2934} failed due to the following error: 80040154. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) I've looked up the error code, and it appears to indicate that the service isn't registered. That's nonsense in my case, since I'm trying to access a service provided by the operating system (explorer.exe, to be specific). I'm stumped. What might cause Activator.CreateInstance fail, but only rarely?

    Read the article

  • Dynamic Windows Forms Components (Performance problem)

    - by Svisstack
    I have a problem with performance of my code under Windows Forms. Have a form, her layout is depending on constructor data, because he layout must be OnLoad or in Constructor generated. I generation is simple, base FlowLayoutPanel have other FlowLayoutPanels, for each have a Label and TextBox with DataBinding. Problem is this is VERY SLOW, up to 20 seconds, i drawing less than 100 controls, from Performace Session i know a problem is on 70% procesing functions: System.Windows.Forms.Control.ControlCollection.Add(class System.Windows.Forms.Control) System.Windows.Forms.ControlBindingsCollection.Add(class System.Windows.Forms.Binding) How i can do with this? Anyone help me in this problem? How solve the dynamic form layout problem?

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >