1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

More VB 6 Questions

Discussion in 'Software Development' started by websurfer, Feb 24, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    How can I make a MDI Parent non-resizable?

    And, I need to store my global variables and strings in a module form what I have read. Will this module automatically be loaded at the program start or is there a code I need to load it?

    The first one is not that important, but the second is very important ;)
     
  2. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    The declarations in a .bas module will be loaded automatically when your program starts. As for making an MDI parent form non-sizeable, give me some time on that one. I have a feeling it can be done but it make take a Win32 API call to do it.
     
  3. Piringa

    Piringa

    Joined:
    Sep 18, 2002
    Messages:
    494
    You guys are so geeky n cool, I can't believe I didnt continue my classes at the local college. I did introduction to programming, (pseudocode). I wanna go back but Im so dam lazy. ):(
     
  4. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    Here's one way to keep user from resizing an MDI parent form. The drawback to this method is that it causes a flicker effect in the form which I find distasteful. I'm still looking for an API solution.

    If MDIForm1.WindowState <> 1 Then ' allow To Minimize
    MDIForm1.WindowState = 0 'Stop Maximize
    MDIForm1.Width = 4800 ' Original Size
    MDIForm1.Height = 3600 ' Original Size
    End If

    The numbers for the Width and Height properties above come from the default window size when VB adds an MDI form to an application project. Obviously, if you want to use this method then you will have to change those values to whatever is appropriate for your application.
     
  5. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    Will it be able to be modified normally, say I declare intNo1 as Integer, will I be albe to make a command do the following:
    Private Sub cmdCommand_click()
    intNo1 = txtTest.Text
    End Sub

    And is there aythign I need to modfy in the above code?

    Thanks for your help, I will try the MDI code now
     
  6. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    Use the keywords Public or Global to prefix your variable declarations in the .bas module and they will be available for read/write to all parts of your application.

    I've run into the SetWindowLong( ) API function that can be used to subclass a VB window. It can also (apparently) change the properties of an existing window. Setting the border style of your MDI parent form to a dialog frame may accomplish what you need. Be careful to watch for side effects though.
     
  7. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    Ok, I'm having some trouble here, how do I make a text box equal 'Globalvar1' (that is what I named my var and it is declared as a string)?

    I'm a little dense with variables, all my pass apps have used text boxes and combinations of them...
     
  8. AbvAvgUser

    AbvAvgUser

    Joined:
    Oct 3, 2002
    Messages:
    2,281
    You will have to say textbox.text = Glovalvar1
     
  9. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    and how would I make Globalvar1 equal to the textbox? Just gilp it? Would using Const Globalvar1 As String = Text1.Text work?
     
  10. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    No. You can't assign a value to a Const that is not set at compile time. AbvAvgUser's post told you how to do this. Just reverse the order if you want to do the assignment the other way.
     
  11. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    I was asking if flipping would work as well ;) I don't want to take chances by doing something and messing the whole thing up ;)

    Ok, everything is working fine except a little test project with the variables :S

    Here is a zip of it
     
  12. websurfer

    websurfer Thread Starter

    Joined:
    Jun 24, 2002
    Messages:
    1,714
    Oh God I feel stupid!!! I just figured out what I was doing wrong ><
     
  13. AbvAvgUser

    AbvAvgUser

    Joined:
    Oct 3, 2002
    Messages:
    2,281
    :D Every problem seems the most difficult untill it is solved. As soon as it gets solved, it seems the most stupid mistake.

    Don't worry mate, you are not alone. Everyone who has done programming must have had this feeling.

    All the best. ;)
     
  14. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    I once spent hours debugging a section of code because I'd misspelled a variable name. I've been a software developer for going on a dozen years now and I can tell you that noone is immune from those things. :)
     
  15. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/206493

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice