Search Results

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

Page 77/113 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Why doesn't Win Forms application update label immediately?

    - by rosscj2533
    I am doing some experimenting with threads, and made a 'control' method to compare against where all the processing happens in the UI thread. It should run a method, which will update a label at the end. This method runs four times, but the labels are not updated until all 4 have completed. I expected one label to get updated about every 2 seconds. Here's the code: private void button1_Click(object sender, EventArgs e) { Stopwatch watch = new Stopwatch(); watch.Start(); UIThreadMethod(lblOne); UIThreadMethod(lblTwo); UIThreadMethod(lblThree); UIThreadMethod(lblFour); watch.Stop(); lblTotal.Text = "Total Time (ms): " + watch.ElapsedMilliseconds.ToString(); } private void UIThreadMethod(Label label) { Stopwatch watch = new Stopwatch(); watch.Start(); for (int i = 0; i < 10; i++) { Thread.Sleep(200); } watch.Stop(); // this doesn't set text right away label.Text = "Done, Time taken (ms): " + watch.ElapsedMilliseconds; } Maybe I'm just missing something basic, but I'm stuck. Any ideas? Thanks.

    Read the article

  • Determine how an application is closed

    - by Mike_G
    I am trying to determine if my application is closed through clicking the "X" on the windows form, or if they clicked an "Exit" button I have on it. Right now I am using StackTrace.GetFrame(someIndex) to determine how, but i am looking for a more definitive way since it looks like these frame orders arent guaranteed. Is there a better way to make the distinction? This is a .NET 3.5 WinForm, and Im writing in C#.

    Read the article

  • Adding a Design time Panel to a TabPage at run time

    - by BDotA
    Hi, I wish to have a Panel with the controls on it at design time but I want to add this panel to a desired tabPage of my TabControl at run time. I wrote something like this, did not work : the panel does not show up in the tab page. please help me. panel2.Parent = tabGuy.TabPages[0]; tabGuy.SuspendLayout(); tabGuy.TabPages[0].Controls.Add(panel2); tabGuy.ResumeLayout(); panel2.Show();

    Read the article

  • Generating Color Gradient

    - by Malfist
    I want to display to my user how many (percent wise) of their forms are compliant with the new standard. The way I want to let them know visually is the percent amount will be colored. It will be 0xFF0000 (pure red) for 0% and 0x00FF00 (pure green) at 100%. What is the best way to calculate the color for each step along the way?

    Read the article

  • Click once Deployment suddenly does not work. Displays windows login?

    - by Raja
    Hello All, I am facing a peculiar issue. We use click once deployment for our windows application. It was working fine till last week. I made some changes to the application (just code nothing changed in properties) and suddenly I cannot publish anymore. When we give publish now it displays windows authentication dialog and when we provide the credentials nothing happens. It tries to connect to remote server (local LAN) and shows the dialog again. Any idea why this happens? Thanks for your help.

    Read the article

  • Creating a image viewer window controll.

    - by Scott Chamberlain
    I am learning GDI+ and I am trying to make a display window with scroll bars (so I can only see part of the image at a time and I can scroll around it). I have read through the basics of GDI+ from several books but I have not found any good tutorials online or in books available to me about doing more advanced things like this. Any recommendations on guides or example code on how do do this? Here is what I have so far protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Label != null) { using (Bitmap drawnLabel = new Bitmap(Label.LabelHeight, Label.LableLength, System.Drawing.Imaging.PixelFormat.Format1bppIndexed)) using (Graphics drawBuffer = Graphics.FromImage(drawnLabel)) { drawBuffer.ScaleTransform(_ImageScaleFactor, _ImageScaleFactor); foreach (Epl2.IDrawableCommand cmd in Label.Collection) { cmd.Paint(drawBuffer); } drawBuffer.ResetTransform(); } } } I would like to paint this in to a PictureBox I have on the control and control what is shown by a VScrollBar and HScrollBar but I don't know how to do that step. P.S. Label is a custom class that I have in my namespace, it is a object that represents a label you would print from a label printer.

    Read the article

  • Crossthread exception and invokerequired solution doesn't change my control value

    - by Pilouk
    EDIT Solution : Here i'm setting my byref value in each object then i'm running a backgroundworker Private Sub TelechargeFichier() Dim DocManquant As Boolean = False Dim docName As String = "" Dim lg As String = "" Dim telechargementFini As Boolean = False lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1478") prgBar.Maximum = m_listeFichiers.Count For i As Integer = 0 To m_listeFichiers.Count - 1 m_listeFichiers(i).Set_ByRefLabel(lblMessage) m_listeFichiers(i).Set_ByRefPrgbar(prgBar) m_listeThreads.Add(New Thread(AddressOf m_listeFichiers(i).DownloadMe)) Next m_bgWorker = New BackgroundWorker m_bgWorker.WorkerReportsProgress = True AddHandler m_bgWorker.DoWork, AddressOf DownloadFiles m_bgWorker.RunWorkerAsync() ''Completed 'lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1383") 'Me.DialogResult = System.Windows.Forms.DialogResult.OK End Sub Here is my downloadFiles function : Note that each start will do the downloadMe function see below too Private Sub DownloadFiles(sender As Object, e As DoWorkEventArgs) For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Start() Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Join() Next End Sub I have multiple thread that each will download a ftp file. I would like that each file that have been completed will set a value to a progress bar and a label from my UI thread. For some reason invokerequired never change to false. Here is my little function that start all the thread Private Sub TelechargeFichier() Dim DocManquant As Boolean = False Dim docName As String = "" Dim lg As String = "" Dim telechargementFini As Boolean = False lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1478") prgBar.Maximum = m_listeFichiers.Count For i As Integer = 0 To m_listeFichiers.Count - 1 m_listeFichiers(i).Set_ByRefLabel(lblMessage) m_listeFichiers(i).Set_ByRefPrgbar(prgBar) m_listeThreads.Add(New Thread(AddressOf m_listeFichiers(i).DownloadMe)) Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Start() Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Join() Next 'Completed lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1383") Me.DialogResult = System.Windows.Forms.DialogResult.OK End Sub Here my property that hold the Byref control from the UI thread. This is in my object which content the addressof function that will download the file (DownloadMe) Public Sub Set_ByRefPrgbar(ByRef prgbar As ProgressBar) m_prgBar = prgbar End Sub Public Sub Set_ByRefLabel(ByRef lbl As EasyDeal.Controls.EasyDealLabel3D) m_lblMessage = lbl End Sub Here is the download function : Public Sub DownloadMe() Dim ftpReq As FtpWebRequest Dim ftpResp As FtpWebResponse = Nothing Dim streamInput As Stream Dim fileStreamOutput As FileStream Try ftpReq = CType(WebRequest.Create(EasyDeal.Controls.Common.FTP_CONNECTION & m_downloadFtpPath & m_filename), FtpWebRequest) ftpReq.Credentials = New NetworkCredential(FTP_USER, FTP_PASS) ftpReq.Method = WebRequestMethods.Ftp.DownloadFile ftpResp = ftpReq.GetResponse streamInput = ftpResp.GetResponseStream() fileStreamOutput = New FileStream(m_outputPath, FileMode.Create, FileAccess.ReadWrite) ReadWriteStream(streamInput, fileStreamOutput) Catch ex As Exception 'Au pire la fichier sera pas downloader Finally If ftpResp IsNot Nothing Then ftpResp.Close() End If Dim nomFichier As String = m_displaynameEN If EasyDealChangeLanguage.GetCurrentLanguageTypes = EasyDealChangeLanguage.EnumLanguageType.Francais Then nomFichier = m_displaynameFR End If If m_lblMessage IsNot Nothing Then EasyDealCommon.TH_SetControlText(m_lblMessage, String.Format(EasyDealChangeLanguage.Instance.GetStringFromResourceName("1479"), nomFichier)) End If If m_prgBar IsNot Nothing Then EasyDealCommon.TH_SetPrgValue(m_prgBar, 1) End If End Try End Sub Here is the crossthread invoke solution function : Public Sub TH_SetControlText(ByVal ctl As Control, ByVal text As String) If ctl.InvokeRequired Then ctl.BeginInvoke(New Action(Of Control, String)(AddressOf TH_SetControlText), ctl, text) Else ctl.Text = text End If End Sub Public Sub TH_SetPrgValue(ByVal prg As ProgressBar, ByVal value As Integer) If prg.InvokeRequired Then prg.BeginInvoke(New Action(Of ProgressBar, Integer)(AddressOf TH_SetPrgValue), prg, value) Else prg.Value += value End If End Sub The problem is the invokerequired never get to false it actually goes in to beginInvoke but never end in the Else section to set the value.

    Read the article

  • Resizing Grid Views On Window Resize

    - by Jack Mills
    I'm making a small Windows Forms application that contains a lot of grid views. I want all the grid views to resize with the window. I could make a function that detects window resize and then changes the size of each grid view but that feels a bit clunky. Is there not an easier/more intelligent way to do this

    Read the article

  • How to handle the close (big X) button at the source?

    - by Simon T.
    We would like under some circumstances to block the action of the close button in the title bar. The problem is that it's a MDI applications and it seems that we will have to add code in each forms to cancel the operation in the Closingevent handler. It seems that the child forms are the first to receive the event. There is no way to add code at a single place to cancel the close operation. Information on how the close event is propagated to the child form would be welcome. Is there a simple way of doing what we want to do?

    Read the article

  • How to catch key press on a form c# .net

    - by flavour404
    Hi, I have a parent form that contains a lot of controls. What I am trying to do is filter all of the key presses for that form. The trouble is that if the focus is on one of the controls on the form then the parent form is not getting the key press event, so how do I capture the key down event? Thanks, R.

    Read the article

  • Installer Vs. Desktop application

    - by Ram
    hi, I was just wondering why do we need installer programs to create setups? We can create a desktop application which will do registry changes, registration of assembly, creation of config files and all. Why dedicated installers are there? Do they serve any other purpose or task that a desktop application cannot do?

    Read the article

  • Center current record in DataGridView

    - by Max
    When programmatically changing the current record in the DataGridView is it possible to make it in such way that this record would be centered (vertically) in the grid? When I change the current record it is shown either as the top row or as the bottom row. I'd like it to be in the middle. Would this be possible/simpler in WPF?

    Read the article

  • referencing files that were included with vb.net solution

    - by every_answer_gets_a_point
    my application builds a pdf with images in the solution explorer i added a folder called pics and dropped all the images there when i run the program from my computer, there are no problems, but when i had a different user install the application they get this error: here's how i am including the image: Dim jpeg2 As Image = Image.GetInstance(Application.StartupPath & "\pics\1.jpg") i am using the itextsharp library why is the user having this problem?

    Read the article

  • How to parse the table from webpage where there are many webpage.

    - by Harikrishna
    There are many tables in the one webpage from that I want to extract the data from only one table. I am using Html Agility Pack to parse the html table.There are many tables in one webpage but I want to extract the data from only one table. So I will first find that table for which I want to extract the data which I can do.Now problem is once I find that table,what I should do to extract the data from only that table ?

    Read the article

  • How do you get the solution directory in C# (VS 2008) in code?

    - by IsaacB
    Hi, Got an annoying problem here. I've got an NHibernate/Forms application I'm working through SVN. I made some of my own controls, but when I drag and drop those (or view some form editors where I have already dragged and dropped) onto some of my other controls, Visual studio decides it needs to execute some of the code I wrote, including the part that looks for hibernate.cfg.xml. I have no idea why this is, but (sometimes!) when it executes the code during my form load or drag and drop it switches the current directory to C:\program files\vs 9.0\common7\ide, and then nhibernate throws an exception that it can't find hibernate.cfg.xml, because I'm searching for that in a relative path. Now, I don't want to hard code the location of hibernate.cfg.xml, or just copy hibernate.cfg.xml to the ide directory (which will work). I want a solution that gets the solutions directory while the current directory is common7\ide. Something that will let someone view my forms in the designer on a fresh checkout to an arbitrary directory on an arbitrary machine. And no, I'm not about to load the controls in code. I have so many controls within controls that it is a nightmare to line everything up without it. I tried a pre build event that made a file that has the solution directory in it, but of course how can I find that from common7\ide? All the projects files need to be in the solution directory because of svn. Thanks for your help guys, I've already spent a few hours fiddling with this in vain.

    Read the article

  • How to find padding space around the label text?

    - by Ganesh
    I am adding a label controls at run time. I can add or modify text in label and can change the font also.Now my problem is When i changed the font of text in label, alignment is not proper,its due to padding.Is there any way to find how much padding is ocured [ed: obscured?] based on font?

    Read the article

  • How to store data in a table locally and present it in C#

    - by joslinm
    I want to setup a table that can: Save the data on the user's machine Reference & present the data in the GUI Capable of adding rows dynamically during runtime What's the best way to go about this? DataGridView or TableLayoutPanel or...? I'm having trouble with SQL server CE, as I was going to connect it with the DataGridView, but I'm very new to this kind of work, and wondered if it was even necessary to use SQL.

    Read the article

  • Underlining 3 words at a time in WPF

    - by user102533
    In WPF, how would I do the following: Every x milliseconds, underline 3 words at a time. After x milliseconds, underline the next 3 words. Every x milliseconds, have 3 words appear and disappear from the window? If I were to use Windows Forms, is there still a way of doing (1) and (2) above? Thank you

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >