Hi,
I'm sorry if I'm missing something obvious here, but I haven't had my coffee yet so I'm not really awake yet
I'm developing an application that should run on a 'kind of' mobile device. It's not exactly a mobile device (hence I'm not developing in the mobile framework, just winforms), but I can't use various Forms either.
Right now I am working on a proof of concept, and I simulated the mobile device simply with a UserControl that has a fixed size. Everything needs to happen on that UserControl, and I cannot display any other forms.
However, I now need a 'Dialog Form' to let the user enter some data (mainly text but it doesn't really matter). What I'm doing now is simply showing a Panel with a TextBox, OK button and Cancel button. I bring that panel to the front, hiding the rest of the application, when required. The different Panels (there's also one for a CheckBox, ComboBox, and the main application is also on a Panel) are all on a 'PanelContainer' UserControl I made, and I can switch panels simply by specifying their 'key' (a string such as "TEXT", "CHECK", "COMBO" etc). So I can display the textbox panel by simply doing
That brings the textbox panel to the front.Code:panelContainer1.SelectedKey = "TEXT"
What I want now is that I can 'show' the panel as if it were a Dialog form. That means that the code 'waits' until the user has entered his text and either clicked OK or Cancel. Then I could use it like this
Right now I cannot do that.. The code continues right away after the panel has been shown, and the only other option (I think) is to let the panel raise an event when the user is done with it, so that I can handle the event. The problem with that is that I would then have to check in the event handler what he was editing, where the result should go, etc... It would be so much better if I could just use the panel as if it were a dialog form... But I have no idea how to do that!Code:' Show the panel here Dim result As DialogResult = panelContainer1.Panels("TEXT").ShowDialog() ' and immediately use the result (the code won't come here until the user has selected ok or cancel) If result = DialogResult.OK Then '... End If
Is it even possible?
I suppose I should give the panel a ShowDialog method:
I'm not sure if I'm missing something REALLY obvious here... But I've never had the need to do this as I can normally just use a dialog formCode:Public Class TextboxPanel Inherits SwitchPanel ' switchpanel is the base class with OK/Cancel buttons and inherits Panel Public Function ShowDialog() As DialogResult Me.BringToFront() 'show it ' wait for user input..? Return ...? result? End Function End Class
Thanks!






Reply With Quote