Search Results

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

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

  • Drawing a relative line in C#

    - by icemanind
    Guys, I know this is going to turn out to be a simple answer, but I can't seem to figure it out. I have a C# Winform application that I am trying to build. I am trying to draw a white line 60 pixels above the bottom of the form. I am using this code: private void MainForm_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawLine(Pens.White, 10, this.Height-60, 505, this.Height-60); } Simple enough, however no line is drawn. After some debugging, I figured out that it IS drawing the line, but it is drawing it outside my form. If I change the -60 to -175, then I can see it at the bottom of my form. This would solve my problem, except as my form's height changes, the line draws closer and closer to the bottom of my form until eventually, its off the form again. What am I doing wrong? Am I using the wrong graphics unit? Or is there a more complex calculation I need to do to determine 60 pixels from the bottom of my form?

    Read the article

  • help me to cheat with numericUpDown1_ValueChanged event

    - by alex
    I have a Form and numericupdown control located on it. I want that in some conditions (_condition1) user cannot be able to change a value of numericupdown control. How can I do it ? I wrote some code but it works twice (double time). class Form1 : Form { bool _condition1; int _previousValue; void numericUpDown1_ValueChanged(object sender, EventArgs e) { if(_condition1) { numericUpDown1.Value = (decimal)_previousValue; } else { _previousValue = (int)numericUpDown1.Value; } } } Control must be enable.

    Read the article

  • How to change Arrow Keys Behavior?

    - by SO give me back my rep
    Hi, I am doing a cool menu (sorta XMB) to give a fresh touch to my app... I add all of the elements on the menu programatically via DB. the menu is designed for easy use with arrows keys but I have encountered a major problem!!! by default when I press the arrow keys they only change the focus based on the tabindex and what I need is to change focus based on position of the controls not on their tabindex hope it is clear... see pic!!! so, Is there any way to do this?

    Read the article

  • IS there a simple way to remove Alt-Character shortcuts at runtime

    - by Dan Neely
    I have a dialog with a number of Alt-Letter shortcuts on labels for textboxes/etc. This dialog can present data in either an editable or a read-only mode. I've received a request to hide the underlines for the shortcuts if the dialog is in read only mode. Other than editing the label text at runtime (ugh) is there any way to remove them? If you don't know what I'm referring to by alt-Letter shortcuts see this question.

    Read the article

  • Databinding a property with a parameter

    - by clawson
    I would like to databind to a property that requires arguments. What is the best way do to this? are there work arounds? I'm open to any suggestions. I thought about defining custom columns and cells because the parameters that the property requires are available from the within the object bound to the row, but I'm having trouble materialising this idea. Thanks in advance for the help.

    Read the article

  • How to set source path of image within html pages to show in webbrowser control

    - by Royson
    Hi in my application there is web browser control to show some static html pages. The pages are displayed properly. but images are not displayed.. I tried with changing src-path but no success. my htmlpages folder is located at bin folder. And i am assigning it as. FileStream source = new FileStream(@"..\HtmlPages\supportHtml.html", FileMode.Open, FileAccess.Read); if i open html files in browser, the images are displayed properly.. So, What is the correct path for images..?? If i set full path to src attribute of <img> tag..it works. but i think its not a proper way. :( EDIT: If i assign d:\myapp\bin\HtmlPages\support.gif then image is displayed. And if i assign "..\HtmlPages\support.gif" or "support.gif" image is not shown.

    Read the article

  • Double confirmation on exit

    - by Sean
    I am trying to make it so that the user is prompted to confirm exiting my program in c#, but for some reason, if they say "yes" they would like to exit, the confirmation box would pop up again. I can't figure out why. if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { Application.Exit(); }

    Read the article

  • Why does TabStop stop working??

    - by Jerry
    I have a project that uses a series of auto-generated user control instances. The user-control itself exists, but I populate a panel with a series of these user controls, one for each item in my collection. Each user control displays a ton of information, but only ONE text field is editable. All of the other fields have TabStop set to false, and are marked as ReadOnly. The tab order of each user control is set at the time it is created so that the tab-key goes from one field to the next (or ... it's supposed to). When I have TWO fields on my user control whose TabStop is set to true, everything works great. But if I only have ONE field whose TabStop is true, the tab key stops working, and I have to physically CLICK on the next user control for it to gain focus. What's up? Has anyone else seen this behavior? Am I doing something stupid as usual?

    Read the article

  • C#.NET DataGridView - update database

    - by Geo Ego
    I know this is a basic function of the DataGridView, but for some reason, I just can't get it to work. I just want the DataGridView on my Windows form to submit any changes made to it to the database when the user clicks the "Save" button. On form load, I populate the DataGridView and that's working fine. In my save function, I basically have the following (I've trimmed out some of the code around it to get to the point): using (SqlDataAdapter ruleTableDA = new SqlDataAdapter("SELECT rule.fldFluteType AS [Flute], rule.fldKnife AS [Knife], rule.fldScore AS [Score], rule.fldLowKnife AS [Low Knife], rule.fldMatrixScore AS [Matrix Score], rule.fldMatrix AS [Matrix] FROM dbo.tblRuleTypes rule WHERE rule.fldMachine_ID = '1003'", con)) { SqlCommandBuilder commandBuilder = new SqlCommandBuilder(ruleTableDA); DataTable dt = new DataTable(); dt = RuleTable.DataSource as DataTable; ruleTableDA.Fill(dt); ruleTableDA.Update(dt); } Okay, so I edited the code to do the following: build the commands, create a DataTable based on the DataGridView (RuleTable), fill the DataAdapter with the DataTable, and update the database. Now ruleTableDA.Update(dt) is throwing the exception "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." Thanks very much!

    Read the article

  • Is this part of MVC in .NET?

    - by 4thSpace
    I have a .NET MVC winform app. I've created an AppDelegate class that handles application startup and shutdown...for now (it might do more later). Winform apps have a Program.cs file that does some app initialization, starts the message pump and creates the first form. In my app, the first form is AppDelegate, which isn't really a form but is forced that way by Application.Run(). AppDelegate does any further app initialization and starts the first Controller, which then initializes any child controllers (these then create their views). I don't consider events occuring in Program.cs and AppDelegate as part of the MVC. Conceptually, what would these be called?

    Read the article

  • String Manipulation.

    - by Harikrishna
    I will have a different type of string(string will not have fixed format,they will be different every time) from them I want to remove some specific substring.Like the string can be FUTIDX 26FEB2009 NIFTY 0 FUTSTK ONGC 27 Mar 2008 FUTIDX MINIFTY 30 Jul 2009 FUTIDX NIFTY 27 Aug 2009 NIFTY FUT XP: 29/05/2008 Actuall I want the string from every string defined above like NIFTY-FEB09 ONGC-MAR08 MINIFTY-JUL09 NIFTY-AUG09 NIFTY-MAY08 How can I do that ?

    Read the article

  • form not showing

    - by Luke
    Perhaps this has something to do with it being the mainForm, but I'll ask the question. I have my mainForm that is the first to load when the program is booted. I then click a button called Add, which should open a new form, and close the mainForm. The problem is, is shows the new form for a split second, then closes both. The code: private void addFrmBtn_Click(object sender, EventArgs e) { saveForm saveform = new saveForm(); saveform.Show(); this.Close(); }

    Read the article

  • Mapping Application for Middle East

    - by Faraz
    We have a desktop application that has been using MapPoint for displaying data on a European map. We now want to support Middle East maps, but MapPoint only support North America and Europe. Is there any other alternative to MapPoint that can be easily integrated in a .NET based Win Forms application?

    Read the article

  • add row to a BindingSource gives different autoincrement value from whats saved into DB

    - by Ruben Trancoso
    I have a DataGridView that shows list of records and when I hit a insert button, a form should add a new record, edit its values and save it. I have a BindingSource bound to a DataGridView. I pass is as a parameter to a NEW RECORD form so // When the form opens it add a new row and de DataGridView display this new record at this time DataRowView currentRow; currentRow = (DataRowView) myBindindSource.AddNew(); when user confirm to save it I do a myBindindSource.EndEdit(); // inside the form and after the form is disposed the new row is saved and the bindingsorce position is updated to the new row DataRowView drv = myForm.CurrentRow; avaliadoTableAdapter.Update(drv.Row); avaliadoBindingSource.Position = avaliadoBindingSource.Find("ID", drv.Row.ItemArray[0]); The problem is that this table has a AUTOINCREMENT field and the value saved may not correspond the the value the bindingSource gives in EDIT TIME. So, when I close and open the DataGridView again the new rowd give its ID based on the available slot in the undelying DB at the momment is was saved and it just ignores the value the BindingSource generated ad EDIT TIME, Since the value given by the binding source should be used by another table as a foreingKey it make the reference insconsistent. There's a way to get the real ID was saved to the database?

    Read the article

  • How can I add an Items-like property to my User Control?

    - by Dan Tao
    It's pretty straightforward to add simple properties to a User Control that will appear in the desired categories in the Windows Forms designer, e.g.: [Category("Appearance")] public Color BackColor { get { return _textBox.BackColor; } set { _textBox.BackColor = value; } } What if I want to expose a more complex property, such as a collection of items of a type I define? I'm thinking something along the lines of the ListView.Items property, or the DataGridView.Columns property -- where the user of the control can access this complex property via a more specialized pop-up form (as opposed to a simple TextBox or ComboBox). Even a simple nudge in the right direction would be much appreciated.

    Read the article

  • Getting "" at the beginning of my XML File after save()

    - by Remy
    I'm opening an existing XML file with c# and I replace some nodes in there. All works fine. Just after I save it, I get the following characters at the beginning of the file:  (EF BB BF in HEX) The whole first line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> The rest of the file looks like a normal XML file. The simplified code is here: XmlDocument doc = new XmlDocument(); doc.Load(xmlSourceFile); XmlNode translation = doc.SelectSingleNode("//trans-unit[@id='127']"); translation.InnerText = "testing"; doc.Save(xmlTranslatedFile); I'm using a C# WinForm Application. With .NET 4.0. Any ideas? Why would it do that? Can we disable that somehow? It's for Adobe InCopy and it does not open it like this. UPDATE: Alternative Solution: Saving it with the XmlTextWriter works too: XmlTextWriter writer = new XmlTextWriter(inCopyFilename, null); doc.Save(writer);

    Read the article

  • Using Client Application Services in windows forms not working

    - by Nickson
    i am trying to implement asp.net membership, profile and role based security in a windows application by configuring client Application Services for my windows forms application. I have followed both these articles http://www.dotnetbips.com/articles/e863aa3c-0dd6-468d-bd35-120a334c5030.aspx and http://msdn.microsoft.com/en-us/library/bb546195.aspx step-by-step but for some reason i can't get the authentication working. I have a deployed intranet asp.net website which is already using an asp.net membership database for authentication and want to use that same database for authenitcation in my windows forms application. The site URL is http://myServer_Name:My_Port and i am specifying that URL as the both the Authentication service location and Roles service location in the windows application services property tab. But in the windows application login form, when i say Dim msg As String = "Welcome " If Not Membership.ValidateUser(UsernameTextBox.Text), PasswordTextBox.Text)) Then MessageBox.Show("Invalid User ID or Password!") Else msg = msg + UsernameTextBox.Text End If i get my "Invalid User ID or Password!" message even when i supply a valid user name with the corresponding password. i am able to login with the same credentials from the asp.net site. How can i test if the Authentication service location is being reached from the windows application?? Or what other information can i provide here such that one is able to help me get this working??

    Read the article

  • Controls resize based on screen resolution

    - by user337173
    I have panel control. More controls are in panel.I set the dock property for panel as 'fill' .The panel are resized based on screen resolution. but the controls remains same.The controls in the panel are not resized based on screen solution. i have more labels and panels and text-boxs and button in the same page. How to set the dock property to resize all controls in page based on screen resolution? Thanks for any help

    Read the article

  • Datatable and Datagridview.

    - by Harikrishna
    I have datatable table like id name address phoneno 1 abc kfjskl 798798 2 bcd kjdsfl 808909 3 899009 fjsh kjllkjl 5 jfkd And I am displaying this value in the datagridview by code dataGridView1.ColumnCount = Table.Columns.Count; dataGridView1.RowCount = Table.Rows.Count; for (int i = 0; i < dataGridView1.RowCount; i++) { for (int j = 0; j < dataGridView1.ColumnCount; j++) { dataGridView1[j, i].Value = Table.Rows[i][j].ToString(); } } Now I don't want to display row that has some missing value like If I will do that then the datagridview will look like 1 abc kfjskl 798798 2 bcd kjdsfl 808909 How can I do that ?

    Read the article

  • Can you expose XML webservices from a Windows Forms Application?

    - by Andrei
    This might sound like a silly question, but when I search for webservices, I get no information about how to create them in a windows forms application. The only result is how to create and expose them by creating an .aspx page. So my questions is: Can you create and expose webservices within a windows forms application or are they somehow tied in with .asp pages? Thanks! later edit: Is there an example of how to create a webservice in a .cs file and not in a .aspx file?

    Read the article

  • How to display static (shared) object's properties via a Forms 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 this 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

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