Search Results

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

Page 65/113 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • DataGridView not displaying data in ToolStripControlHost

    - by jblaske
    I'm utilizing the code posted by Jesper Palm here: http://stackoverflow.com/questions/280891/make-user-control-display-outside-of-form-boundry /// <summary> /// A simple popup window that can host any System.Windows.Forms.Control /// </summary> public class PopupWindow : System.Windows.Forms.ToolStripDropDown { private System.Windows.Forms.Control _content; private System.Windows.Forms.ToolStripControlHost _host; public PopupWindow(System.Windows.Forms.Control content) { //Basic setup... this.AutoSize = false; this.DoubleBuffered = true; this.ResizeRedraw = true; this._content = content; this._host = new System.Windows.Forms.ToolStripControlHost(content); //Positioning and Sizing this.MinimumSize = content.MinimumSize; this.MaximumSize = content.Size; this.Size = content.Size; content.Location = Point.Empty; //Add the host to the list this.Items.Add(this._host); } } I've translated it to VB: Public Class PopupWindow Inherits System.Windows.Forms.ToolStripDropDown Private _content As System.Windows.Forms.Control Private _host As System.Windows.Forms.ToolStripControlHost Public Sub New(ByVal content As System.Windows.Forms.Control) Me.AutoSize = False Me.DoubleBuffered = True Me.ResizeRedraw = True Me._content = content Me._host = New System.Windows.Forms.ToolStripControlHost(content) Me.MinimumSize = content.MinimumSize Me.MaximumSize = content.MaximumSize Me.Size = content.Size content.Location = Point.Empty Me.Items.Add(Me._host) End Sub End Class It works great with a PictureBox showing its information. But for some reason I cannot get the DataGridView to display anything when it is in the popup. If I pull the grid out of the popup it displays all of its information fine. If I pause during debug, the grid shows that it has all the data in it. It's just not displaying anything. Does anybody have any ideas?

    Read the article

  • How to know there is something in the cell or not ?

    - by Harikrishna
    I have table like below in the html file: <table border="1"> <tr> <td>BuyQuantity</td><td>SellQuantity</td> </tr> <tr> <td>15D</td><td>&nbsp;<span style="font-family: &quot;Arial Unicode MS&quot;;"><o:p></o:p></span></p></td> </tr> <tr> <td>&nbsp;<span style="font-family: &quot;Arial Unicode MS&quot;;"><o:p></o:p></span></td><td>38D</td> </tr> <tr> <td>&nbsp;<span style="font-family: &quot;Arial Unicode MS&quot;;"><o:p></o:p></span></td><td>99D</td> </tr> <tr> <td>38D</td><td>&nbsp;<span style="font-family: &quot;Arial Unicode MS&quot;;"><o:p></o:p></span></td> </tr> </table> There are two columns: buy-quantity and sell-quantity.(It is only example but in each html file there is different content in the table.) Now with the content of these two columns I want to decide there is items bought or items sold.Like in the first row there is 15d buy-qauntity then items were bought and in the second row there is 38d sell-qauntity then items were sold and so on. And after deciding there is items-bought or items-sold I want to build one column named buy/sell for this table like below: ![alt text][1] [1]: http://C:\Documents and Settings\Administrator\My Documents\My Pictures\untitled.png How can I do this ?

    Read the article

  • Listview Multiple Selection

    - by Evan
    Is there any way to force a listview control to treat all clicks as though they were done through the Control key? I need to replicate the functionality of using the control key (selecting an item sets and unsets its selection status) in order to allow the user to easily select multiple items at the same time. Thank you in advance.

    Read the article

  • Displaying Fields (and/instead of Properties) in a PropertyGrid

    - by Jenk
    I'd like to use a PropertyGrid to manipulate the data on some objects, however these objects don't have properties, they have fields. Thus a property grid doesn't display them (high five MS!) Before anyone posts "just use properties": I can't at the moment.. these objects are DTOs and are used to send data to a VB6 Interop dll, thus all the parameters for the method calls are "ref" parameters (high five MS!), and C# won't compile if you use a property instead of a field or variable (high five MS!). No, I am not going to create local variables for every property on any given object. There many, many fields, and many, many test cases that would need updating, as well as the production code it self, and this post/question may be the path of least resistance. :)

    Read the article

  • Saving formatted text from richtextbox

    - by phenevo
    Hi, Is there any way, to save formatted in database from richtextbox? I've got richtextbox and some parts of text in this are bold. string s=richtextbox.Text obviously doesn't work. And If I can get this formatted text how to save it in Ms Sql Server 2005 ?

    Read the article

  • C# image drawing colours are incorrect

    - by Jon Tackabury
    I have a source bitmap that is 1x1 and I am trying to take that image and draw it to a new bitmap. The source bitmap is all red, but for some reason the new bitmap ends up with a gradient (see image). Using the code below, shouldn't the new bitmap be completely red? Where is it getting the white/alpha from? private void DrawImage() { Bitmap bmpSOURCE = new Bitmap(1, 1, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bmpSOURCE)) { g.Clear(Color.Red); } Bitmap bmpTest = new Bitmap(300, 100, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bmpTest)) { g.CompositingMode = CompositingMode.SourceCopy; g.CompositingQuality = CompositingQuality.AssumeLinear; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PageUnit = GraphicsUnit.Pixel; g.PixelOffsetMode = PixelOffsetMode.None; g.SmoothingMode = SmoothingMode.None; Rectangle rectDest = new Rectangle(0, 0, bmpTest.Width, bmpTest.Height); Rectangle rectSource = new Rectangle(0, 0, 1, 1); g.DrawImage(bmpSOURCE, rectDest, rectSource, GraphicsUnit.Pixel); } pictureBox1.Image = bmpTest; }

    Read the article

  • How do you place an Excel Sheet/Workbook onto a C# .NET Winform?

    - by incognick
    I am trying to create a stand alone application in Visual Studio 2008 C# .Net that will house Excel Workbooks (2007). I am using Office.Interop in order to create the Excel application and I open the workbooks via Workbooks.Open(...). The Interop does not provide any functionality to "move" the workbooks onto a form so I turned to P/Invoke Win32 library. I am able to move the entire excel application onto a WinForm with great success: // pseudo code to give you the idea excel = new Excel.ApplicationClass(); SetParent(excel.Hwnd, form.handle); This allows me to customize the form and control user input. All right click commands and formula editing work properly. Now, the issue I run into is when I want to open two workbooks in two separate forms. I do this by creating two excel application classes and placing each of those in their own form. When I try to reference one workbook to another workbook via =[Book2]Sheet1!A1, for example, it does not update. This is expected as each application is running under its own thread/process. Here are the alternatives I have tried. If you have any suggestions I would be greatly appreciative.(OLE is not an option. VSTO must be available) Create a single application class and move the workbook window into my form. Results: The window moves into my form and displays correctly, however, no right click or left click works on the form and it never gains focus. (I have tried to manually set focus and it does not work either). My guess is, by moving the window outside of the XLDESK application (viewable in Spy++ for Excel Application), the workbook application (EXCEL7) does not receive the correct window messages to gain focus and to behave properly. This leads me to: Move the XLDESK window handle into my form. Results: This allows the workbook to be click-able again but also has an undesired result of moving all child windows into the same form. Create a main excel application that creates workbooks. Create a new excel application for each new window. Move the workbook under the new excel application XLDESK window. Results: This also has the same effect of the 1st option. Unable to click in the workbook. This must mean that the thread that created the workbook is also responsible for the events. Create a windows hook that watches the WndProc procedure. Results: No events watched. The targeted thread must export the hook proc in a DLL export call. Excel does not do this and thus you cannot inject into it's DLL (unless someone can prove me wrong). I am able to watch all threads within my own process but not from an outside process. Excel is created as a separate process. Subclass NativeWindow. Results: Same as #4. After I move the window into my form, all events are captured up until the mouse is directly over the excel sheet making the sheet seem unclickable. One idea I haven't tried yet is just to continually save the excel sheet as the user edits it. This should update all references but I would feel this would cause poor system performance. There will be numerous chart references as well and I'm not sure if this solution would cause problems further down the road. I think in the end, all the workbooks need to be created by the same Excel Application and then moved to get the desired results but I can't seem to find the correct way to move the windows without disabling the user input in the process. Any suggestions?

    Read the article

  • How to Solve this Error "Cannot convert lambda expression to type 'string' because it is not a deleg

    - by peace
    . I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue Can you please advice. Employee emp = new Employee(); comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1") select new { x.Id, Name = x.FirstName + " " + x.LastName }; comHandledBySQt.DisplayMember = "Name"; comHandledBySQt.ValueMember = "Id"; Above code should displays drop list of employees first name and last name in a combo box

    Read the article

  • How to add a layer to a menuitem image

    - by alexander
    I have a menuitem with an image. I want to add half-transparent layer to that image. private void menuItem1_Paint(object sender, PaintEventArgs e) { using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, SystemColors.ActiveCaption))) { e.Graphics.FillRectangle(brush, e.ClipRectangle); } } My problem is = I don't know clientrectangle of that image. e.ClipRectangle - it fills whole menuitem. I want to fill only image. How ? Is there another way, maybe ?

    Read the article

  • Creating a new log file each day

    - by Jason T.
    As the title implies how can I create a new log file each day in C#? Now the program may not necessarily run all day and night but only get invoked during business hours. So I need to do two things. How can I create a new log file each day? The log file will be have the name in a format like MMDDYYYY.txt How can I create it just after midnight in case it is running into all hours of the night?

    Read the article

  • How can we block the user from unchecking a DataGridView checkbox?

    - by hawbsl
    We have a DataGridViewCheckBox column bound to a boolean property in our class. The property setter has some logic which says that under certain conditions a True flag cannot be changed, ie, it stays checked forever. This is on a per record basis. So the entire column can't be readonly, only certain rows. Pseudo code: Public Property Foo() As Boolean Get Return _Foo End Get Set(ByVal value As Boolean) If _Foo And Bar And value = False Then //do nothing, in this scenario once you're true, you stay true Else _Foo = value End If End Set End Property Databinding is handling all of this fine, except that the checkbox is visibly cleared when it's clicked. Then, of course, when the binding / setter is fired (as you move off that cell) it is restored to its checked status per the underlying logic. Ultimately it doesn't matter too much but it's a clumsy bit of UI. How can we intercept the user's click and keep it checked?

    Read the article

  • Help setting focus on the parent

    - by serhio
    I have a simple situation (.NET2): a texbox1 on a UserControl1(or Form1). I want to unfocus(leave) the texbox when I click on the usercontrol/form(focus the usercontrol/form instead): I do the following on the UC/form: Protected Overrides Sub OnMouseClick _ (ByVal e As System.Windows.Forms.MouseEventArgs) MyBase.OnMouseClick(e) Me.Focus() End Sub Why does it not work on the child textbox, but works very well on the non-child one(focus on textBox2 then click on the panel removes the focus from the textBox2)? Real project Window

    Read the article

  • C# = assigning custom objects to array with a for loop?

    - by John M
    Given this example: // Create an arary of car objects. car[] arrayOfCars= new car[] { new car("Ford",1992), new car("Fiat",1988), new car("Buick",1932), new car("Ford",1932), new car("Dodge",1999), new car("Honda",1977) }; I tried something like this: for (int i = 0; i < dtable.Rows.Count; i++) { DataRow drow = dtable.Rows[i]; arrayOfCars[] = new car(drow["make"].ToString(), drow["year"].ToString()); } How do I add additional data to the array while looping through a datatable?

    Read the article

  • Creating a Programming Language

    - by Lucifer
    Don't worry, I'm not going to ask that question, yet again... I am wanting to create my own programming language, just for learning sake. I don't want anything other than possibly a few links to head me into the right direction. MSDN Documentation on C# that is specific to what is required to create a language would be great! For the time being, all I am wanting to create is a very simple language that allows me to Create a Form, add a control to it, give that control a location, and maybe even some properties like a Text property, or maybe even a Color property. That's it! Any help / advice at all is greatly appreciated! Thank you :)

    Read the article

  • How to create a dynamically built Context Menu clickEvent

    - by Chris
    C#, winform I have a DataGridView and a context menu that opens when you right click a specific column. What shows up in the context menu is dependant on what's in the field clicked on - paths to multiple files (the paths are manipulated to create a full UNC path to the correct file). The only problem is that I can't get the click working. I did not drag and drop the context menu from the toolbar, I created it programmically. I figured that if I can get the path (let's call it ContextMenuChosen) to show up in MessageBox.Show(ContextMenuChosen); I could set the same to System.Diagnostics.Process.Start(ContextMenuChosen); The Mydgv_MouseUp event below actually works to the point where I can get it to fire off MessageBox.Show("foo!"); when something in the context menu is selected but that's where it ends. I left in a bunch of comments below showing what I've tried when it one of the paths are clicked. Some result in empty strings, others error (Object not set to an instance...). I searched code all day yesterday but couldn't find another way to hook up a dynamically built Context Menu clickEvent. Code and comments: ContextMenu m = new ContextMenu(); // SHOW THE RIGHT CLICK MENU private void Mydgv_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { int currentMouseOverCol = Mydgv.HitTest(e.X, e.Y).ColumnIndex; int currentMouseOverRow = Mydgv.HitTest(e.X, e.Y).RowIndex; if (currentMouseOverRow >= 0 && currentMouseOverCol == 6) { string[] paths = myPaths.Split(';'); foreach (string path in paths) { string UNCPath = "\\\\1.1.1.1\\c$\\MyPath\\"; string FilePath = path.Replace("c:\\MyPath\\", @""); m.MenuItems.Add(new MenuItem(UNCPath + FilePath)); } } m.Show(Mydgv, new Point(e.X, e.Y)); } } // SELECTING SOMETHING IN THE RIGHT CLICK MENU private void Mydgv_MouseUp(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hitTestInfo; if (e.Button == MouseButtons.Right) { hitTestInfo = Mydgv.HitTest(e.X, e.Y); // If column is first column if (hitTestInfo.Type == DataGridViewHitTestType.Cell && hitTestInfo.ColumnIndex == 6) { //MessageBox.Show(m.ToString()); ////MessageBox.Show(m.Tag.ToString()); //MessageBox.Show(m.Name.ToString()); //MessageBox.Show(m.MenuItems.ToString()); ////MessageBox.Show(m.MdiListItem.ToString()); // MessageBox.Show(m.Name); //if (m.MenuItems.Count > 0) //MessageBox.Show(m.MdiListItem.Text); //MessageBox.Show(m.ToString()); //MessageBox.Show(m.MenuItems.ToString()); //Mydgv.ContextMenu.Show(m.Name.ToString()); //MessageBox.Show(ContextMenu.ToString()); //MessageBox.Show(ContextMenu.MenuItems.ToString()); //MenuItem.text //MessageBox.Show(this.ContextMenu.MenuItems.ToString()); } m.MenuItems.Clear(); } } I'm very close to completing this so any help would be much appreciated. Thanks, ~ Chris

    Read the article

  • How can I use a meter-style progress bar?

    - by Yadyn
    In Vista/7, the Windows Explorer shell window makes use of a special kind of static progress bar to display hard drive space. With default styles, this bar is blue colored and non-animated. It also turns red colored when it gets close to being full (low disk space). Using messaging, I can tell the Windows Forms ProgressBar control to update its state to Paused and Error (yellow and red colored, respectively), which works fine, but these are still specific to progress. In the Windows User Experience Guidelines, it specifically points out this "meter" variant of the Progress Bar: This pattern isn't a progress bar, but it is implemented using the progress bar control. Meters have a distinct look to differentiate them from true progress bars. They say it "is implemented using the progress bar control", so... how? What message could I send to the control to have it behave this way? I've seen that you can send messages for setting the bar color, but the documentation says these calls are ignored when visual styles are enabled. Nothing else in the Windows API documentation for raw ProgressBar controls seemed to suggest a way to do this. Am I just stuck making a custom drawn bar? I'd really like to utilize the OS whenever possible so that the application will appear consistent throughout different OS versions. I realize that pre-Vista versions probably won't support this, though. I'm looking for a Windows Forms solution, but I wonder if it is even exposed at all via Win32 API.

    Read the article

  • What, if any, printable character did a user type based on the values in a given System.Windows.Form

    - by Corey Trager
    As a workaround for a problem, I think I have to handle KeyDown events to get the printable character the user actually typed. KeyDown supplies me with a KeyEventArgs object with the properities KeyCode, KeyData, KeyValue, Modifiers, Alt, Shift, Control. My first attempt was just to consider the KeyCode to be the ascii code, but KeyCode on my keyboard is 46, a period ("."), so I end up printing a period when the user types the delete key. So, I know my logic is inadequate. (For those who are curious, the problem is that I have my own combobox in a DataGridView's control collection and somehow SOME characters I type don't produce the KeyPress and TextChanged ComboBox events. These letters include Q, $, %.... This code will reproduce the problem. Generate a Form App and replace the ctor with this code. Run it, and try typing the letter Q into the two comboxes. public partial class Form1 : Form { ComboBox cmbInGrid; ComboBox cmbNotInGrid; DataGridView grid; public Form1() { InitializeComponent(); grid = new DataGridView(); cmbInGrid = new ComboBox(); cmbNotInGrid = new ComboBox(); cmbInGrid.Items.Add("a"); cmbInGrid.Items.Add("b"); cmbNotInGrid.Items.Add("c"); cmbNotInGrid.Items.Add("d"); this.Controls.Add(cmbNotInGrid); this.Controls.Add(grid); grid.Location = new Point(0, 100); this.grid.Controls.Add(cmbInGrid); }

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >