Search Results

Search found 923 results on 37 pages for 'messagebox'.

Page 1/37 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • MessageBox.Show not raising HelpRequested event

    - by Trevortni
    I have a form that is showing a MessageBox using MessageBox.Show, and trying to receive events from the Help button on the MessageBox so I can execute my own code. The Microsoft documentation shows how to do this; however, using what is suggested does not work. Here's a shortened version of my code: Private Function MethodName() As Boolean AddHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Select Case MessageBox.Show("Text", "Title", MessageButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, True) Case MsgBoxResult.Yes ' Do stuff Case MsgBoxResult.No ' Do stuff Case MsgBoxResult.Cancel RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Return False End Select RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested End Function Private Sub MsgBoxHelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) ' Breakpoint that never gets hit ' More code End Sub I've been searching for a solution to this problem, but the best I've found is this question: http://stackoverflow.com/questions/2407880/how-to-detect-help-button-press-in-windows-forms-messagebox that refers me back to the same Microsoft code that doesn't seem to be working. Can anybody help me with this? Thank you.

    Read the article

  • C#: MessageBox.Show(TimeSpan)

    - by every_answer_gets_a_point
    i would like to show a TimeSpan in a MessageBox but am getting an error: DateTime date1 = new DateTime(byear, bmonth, bday, 0, 0, 0); DateTime datenow = DateTime.Now; TimeSpan age = datenow - date1; MessageBox.Show(ToString(age)); Error 1 No overload for method 'ToString' takes '1' arguments how do i output a messagebox with TimeSpan?

    Read the article

  • MessageBox doesn't show on mdi form after a long calculation

    - by Rekreativc
    Hello This is a very similar problem to This one, sadly that one was never answered either. I have a MDI Main forum that hosts several children forms. One of them does a long calculation and throws an exception if an error occurs (all work is done on the same thread). I then try to inform the user of an error with an messagebox, however it doesn't appear (but steals focus from the MDI Main, so the application is completely unresponsive). The beheviour changes slightly if I call Application.DoEvents() (evil I know, but this is a last resort thing). Then the forms remain completely active and the messagebox only appears after I change active application (Alt+Tab) to something else and then back again. What can I do to make sure the messagebox will be visible? I have already tried passing both, active child and MDI Main as parameter to the MessageBox.Show method. It doesn't change the behaviour.

    Read the article

  • Capture keystrokes (e.g., function keys) while a messagebox is up

    - by FastAl
    We have a large WinForms app, and there is a built-in bug reporting system that can be activated during testing via the F5 Key. I am capturing the F5 key with .Net's PreFilterMessage system. This works fine on the main forms, modal dialog boxes, etc. Unfortunately, the program also displays windows messageboxes when it needs to. When there is a bug with that, e.g., wrong text in the messagebox or it shouldn't be there, the messagefilter isn't executed at all when the messagebox is up! I realize I could fix it by either rewriting my own messagebox routine, or kicking off a separate thread that polls GetAsyncKeyState and calls the error reporter from there. However I was hoping for a method that was less of a hack. Here's code that manifests the problem: Public Class Form1 Implements IMessageFilter Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click MsgBox("now, a messagebox is up!") End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Application.AddMessageFilter(Me) End Sub Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) _ As Boolean Implements IMessageFilter.PreFilterMessage Const VK_F5 As Int32 = &H74 Const WM_KEYDOWN As Integer = &H100 If m.Msg = WM_KEYDOWN And m.WParam.ToInt32 = VK_F5 Then ' In reality code here takes a screenshot, saves the program state, and shows a bug report interface ' IO.File.AppendAllText("c:\bugs.txt", InputBox("Describe the bug:")) End If End Function End Class Many thanks.

    Read the article

  • Centralizing Messagebox handling for application

    - by DRapp
    I'm wondering how others deal with trying to centralize MessageBox function calling. Instead of having long text embedded all over the place in code, in the past (non .net language), I would put system and application base "messagebox" type of messages into a database file which would be "burned" into the executable, much like a resource file in .Net. When a prompting condition would arise, I would just do call something like MBAnswer = MyApplication.CallMsgBox( IDUserCantDoThat ) then check the MBAnswer upon return, such as a yes/no/cancel or whatever. In the database table, I would have things like what the messagebox title would be, the buttons that would be shown, the actual message, a special flag that automatically tacked on a subsequent standard comment like "Please contact help desk if this happens.". The function would call the messagebox with all applicable settings and just return back the answer. The big benefits of this was, one location to have all the "context" of messages, and via constants, easier to read what message was going to be presented to the user. Does anyone have a similar system in .Net to do a similar approach, or is this just a bad idea in the .Net environment.

    Read the article

  • YesNo MessageBox not closing when x-button clicked

    - by Simpzon
    When I open a MessageBox with options YesNo, the (usually) cancelling cross in the upper right is shown but has no effect. System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNo); If I offer YesNoCancel as options, clicking the cross closes the Dialog with DialogResult Cancel. System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNoCancel); I would have expected that the cross is "looking disabled" if not hidden at all, when clicking it has no effect. Probably I am not the first one observing this. What is your favorite way to hide/disable this button or workaround the issue? Note: I would prefer a solution that does not use System.Windows.Forms, since I am dealing with WPF projects and would like to avoid any InterOp if possible.

    Read the article

  • Do I need to invoke MessageBox calls?

    - by mafutrct
    To pop-up a message box, I'm using MessageBox.Show(...). I usually wrap this call in an Invoke: BeginInvoke (new Action (() => { MessageBox.Show ()); })); I've got 2 questions: Do I always need to wrap the MessageBox call in an Invoke if I'm calling from a non-GUI thread? If so, should I use BeginInvoke or Invoke? I found not much difference in my tests, BeginInvoke is, as expected (and unlike Invoke), displayed with a slight delay.

    Read the article

  • Only assignment, call, increment, decrement, and new object expressions can be used as a statement : Messagebox

    - by Nuru Salihu
    This what i am trying to achieved if(this.BeginInvoke((Action)(() => MessageBox.Show("Test", MessageBoxButtons.YesNo) == DialogResult.No))) The above gives error. I try seperating the delegate to an outside method like delegate void test(string text); private void SetTest(string text) { if(MessageBox.Show(text,"", MessageBoxButtons.YesNo) == DialogResult.No) } But it breach the very reason why i need the delegate. I found out the first works for me but i don't know how to put it in an if/else statement. Pls any help in a better way i can achieve some thing like below would be appreciated. if(this.BeginInvoke((Action)(() => MessageBox.Show("Test", MessageBoxButtons.YesNo) == DialogResult.No)))

    Read the article

  • RetryCancel MessageBox

    - by mizipzor
    Im using System.Windows.MessageBox.Show() to display a dialog to the user. One overload lets me set the buttons that appear using the System.Windows.MessageBoxButton enum. However, it seems to lack a RetryCancel option that my googling suggests it should have. Am I missing something? How do I display a RetryCancel messagebox?

    Read the article

  • C# Messagebox With ComboBox

    - by Goober
    How can I produce a messagebox in a C# Win Forms application that displays a combobox with a series of values to select as well as the usual "Ok" button? I would like to be able to trigger this on calling the MessageBox.Show() method. I am assuming some sort of override will be necessary, but I haven't seen any pre-existing examples for this.

    Read the article

  • custom button captions in .net messagebox?

    - by subrama6
    Is there an easy way to display a messagebox in VB.Net with custom button captions? I came across this, in the SO archives, but it's for managed C++ http://stackoverflow.com/questions/77293/what-is-an-easy-way-to-create-a-messagebox-with-custom-button-text-in-managed-c

    Read the article

  • Create a Modeless Messagebox

    - by Smashery
    How might one go about creating a Modeless MessageBox? Do I have to just create my own Windows Form class and use that? If so, is there an easy way of adding a warning icon (rather than inserting my own image of one) and resizing based on text volume?

    Read the article

  • How do I get MessageBox button caption?

    - by rodrigoq
    Hello, I'm making a custom message box that lets you copy text, but I wanted it to look exactly like a standard message box, so I would like to set the buttons text to whatever the system language is, as the MessageBox class does. Does anyone knows how to get that text ("Yes", "No", "Cancel", etc)?.

    Read the article

  • Problems related to showing MessageBox from non-GUI threads

    - by Hans Løken
    I'm working on a heavily data-bound Win.Forms application where I've found some strange behavior. The app has separate I/O threads receiving updates through asynchronous web-requests which it then sends to the main/GUI thread for processing and updating of application-wide data-stores (which in turn may be data-bound to various GUI-elements, etc.). The server at the other end of the web-requests requires periodic requests or the session times out. I've gone through several attempted solutions of dealing with thread-issues etc. and I've observed the following behavior: If I use Control.Invoke for sending updates from I/O-thread(s) to main-thread and this update causes a MessageBox to be shown the main form's message pump stops until the user clicks the ok-button. This also blocks the I/O-thread from continuing eventually leading to timeouts on the server. If I use Control.BeginInvoke for sending updates from I/O-thread(s) to main-thread the main form's message pump does not stop, but if the processing of an update leads to a messagebox being shown, the processing of the rest of that update is halted until the user clicks ok. Since the I/O-threads keep running and the message pump keeps processing messages several BeginInvoke's for updates may be called before the one with the message box is finished. This leads to out-of-sequence updates which is unacceptable. I/O-threads add updates to a blocking queue (very similar to http://stackoverflow.com/questions/530211/creating-a-blocking-queuet-in-net/530228#530228). GUI-thread uses a Forms.Timer that periodically applies all updates in the blocking queue. This solution solves both the problem of blocking I/O threads and sequentiality of updates i.e. next update will be never be started until previous is finished. However, there is a small performance cost as well as introducing a latency in showing updates that is unacceptable in the long run. I would like update-processing in the main-thread to be event-driven rather than polling. So to my question. How should I do this to: avoid blocking the I/O-threads guarantee that updates are finished in-sequence keep the main message pump running while showing a message box as a result of an update.

    Read the article

  • MessageBox.Show-- font change?

    - by mmr
    Hi all, I'm using the MessageBox class to show errors to users, and while that might not be the right behavior, it's very convenient. This is a touchscreen application, however, so I need the 'ok' button to be much larger than it is (curse my inordinately large fingers!). I think that if I increase the font size in the dialog box, I should be ok. Is there a way to do that? Or really, is there any way to increase the dialog size? Thanks

    Read the article

  • C# MessageBox Error Messages

    - by Jim Fell
    Hello. In my application I am using message boxes to display error information. try { // Something... } catch (SystemException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } This was fine at first, but as my program grows it becomes increasingly difficult to find the try-catch block where this error is generated. Is there a way to display the line of code or function in which the error was generated? I am using Microsoft Visual C# 2008 Express Edition. Thanks.

    Read the article

  • What is the difference between Invoking and BeginInvoking a MessageBox?

    - by mafutrct
    In a form, compare BeginInvoke (new Action (() => { MessageBox.Show ()); })); with Invoke (new Action (() => { MessageBox.Show ()); })); What is the difference, and when should I use one over the other? How is the behavior affected by the message pump of the MessageBox? I did some testing and found that both methods block the UI. The only difference is that Invoke is actually called instantly while BeginInvoke takes a (very short) time until the code is run. This is to be expected.

    Read the article

  • User prompts (MessageBox) with MVVM

    - by mukapu
    The problem statement: I am tired of thinking how to show a simple message box or user prompt and act based on the response in Model-View-View-Model (MVVM). Common approaches: - It's ok, let's just do this one thing from ViewModel and mock this out for unit testing - Design my own dialog, then what to do from there - Can I write something in view code behind, ah yes, that seems to be the only way out, as anyway MVVM is still not matured...  - and what not?   I am pretty much one among the few frustrated out in this world looking for some convincing answers. I think we can do it a little neater without having the feeling of violating any of our self defined rules! Solution: The Control - Implement a simple control with no designer visibility. - Allow a property to be bound to tell when to show the MessageBox - Provide command binding for possible user actions, Yes, No, Cancel... How do I Use? - Just place the necessary XAML tags in the view - Implement the command for all user actions in the View Model - Run unit tests on the commands

    Read the article

  • Is there a non-blocking version of MessageBox.Show (or something like it)?

    - by Dan Tao
    Often you just want to notify the user that something has occurred, but there's really no need for any input from them. In this common scenario, I sometimes see code like this: MessageBox.Show("Something has occurred", "Something", MessageBoxButtons.OK); This code, as we all know, causes a little pop-up window to appear with only an OK button. Now here's the thing: this code blocks (the UI thread). But in the vast majority of cases, it seems to me, if you only have an OK button, there's very little need to block. (Isn't the purpose of blocking typically to receive some input from the user? And if the user's only choice is "OK," in this typical case, isn't blocking pretty pointless?) Obviously I could just write my own little form that does basically exactly what MessageBox.Show does, except that it returns nothing (no DialogResult) and doesn't block. But I was just wondering if something like this exists already that I didn't know about.

    Read the article

  • How do I get a MessageBox like information window to appear in Java?

    - by John McClane
    I'm learning Java and I have no idea how to do this. I dragged a button on the form in Netbeans, double clicked it and it created this event: @Action public void HelloClickMethod() { JOptionPane.showMessageDialog(this, "The message!", "This is supposed to be the MessageBox title."); } This is the exception the IDE brings up. Cannot find symbol. Symbol: showMessageDialog() Edit 1 Now I changed it to this: @Action public void HelloClickMethod() { JOptionPane.showMessageDialog(this, "The message!", "This is supposed to be the MessageBox title.",JOptionPane.ERROR_MESSAGE); } However the IDE is saying I have an error in the word 'this'. "Cannot find symbol". I don't understand. Why is it so dificult and why are the errors so esoteric. :P

    Read the article

  • How do I create a MessageBox in C# ?

    - by Nick Stinemates
    I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition. I started in the Form Designer and made a button named "Click Me!" proceeded to double-click it and typed in MessageBox("Hello, World!"); I received the following error: MessageBox is a 'type' but used as a 'variable' Fair enough, it seems in C# MessageBox is an Object. I tried the following MessageBox a = new MessageBox("Hello, World!"); I received the following error: MessageBox does not contain a constructor that takes '1' arguments Now I am stumped. Please help.

    Read the article

  • How to detect Help button press in Windows Forms MessageBox?

    - by sashaeve
    I have a message box with 3 buttons: Yes, No, Help: var result = MessageBox.Show("text", "title", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, true); I can detect if Yes/No buttons where clicked something like this: if(result == DialogResult.Yes) // some actions How I can detect that Help button was pressed and execute my own code?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >