Results 1 to 5 of 5

Thread: 2 simple questions but still unsolved.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    110

    2 simple questions but still unsolved.

    Question 1 : how do we open mdi child forms like modal ones ?

    besides opening forms from the menu... there are some dialog box kind of forms.. which should be closed before returning back to its parent form... but it seems there is some problem in showing mdichild as modal... how do i solve it ??


    Question 2 : formatting numbers in textbox ?

    formatting numbers on lostfocus works.
    but i want that whenever any text appears in that textbox..
    it should appear formatted. means i need not lost focus it to make it to correct format.
    Anis Bombaywala

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    MDI children cannot be shown modally, this is what happens when you try:

    An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll

    Additional information: Forms that are not top level forms cannot be displayed as a modal dialog. Remove the form from any parent form before calling showDialog.

    For #2 you could try using TextChanged, although if you change the text on a textchanged event (e.g. formatting) this will make the event handler trigger itself (bad).

  3. #3
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    For question 2:
    You may try to format it on Textbox_Leave event and if not correct format return the focus to that.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    110

    what if..

    the textbox is disabled...
    i want that whenever any number appears it that it should be formatted only...

    i need not leave the textbox for bringing it to correct format.
    Anis Bombaywala

  5. #5
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    If it's disabled, then format the text before you assign it to TextBox.Text.

    ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemStringClassFormatTopic.htm

    Rather than any event code for the textbox itself (if it's disabled there really shouldn't need to be any) put the formatting in whatever code actually sticks the value into the textbox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width