1

I have this huge VB project which i just got from some one. i want to add a check box to a dialog in it so i opened Main2.frm and added a check box using ide. but now when i run the application the dialog resized to its orignal size hence not showing the new check box which is at the bottom. I know that this means somewhere in the code there might be something resizing the dialog box but i have scaned the code and found nothing. where the dialog is being created this is being done:

Main2.vsCodeOptions.Left = 10 Main2.vsCodeOptions.Top = 0

Main2.Move main.Left + (main.Width - Main2.Width) \ 2, main.Top + (main.Height - Main2.Height) \ 2, 3900, 5010
Main2.VSImport.Visible = False
Main2.VSAlload.Visible = False
Main2.VsrepPrt.Visible = False
Main2.VSAbout.Visible = False
Main2.vsCodeOptions.Visible = True

Main2.Left = main.Left + (main.Width - Main2.Width) \ 2
Main2.Top = main.Top + (main.Height - Main2.Height) \ 2
'Use this code to make the form stay on top in the form module:
SetWindowPos Main2.hWnd, HWND_TOPMOST, Main2.Left, Main2.Top, 0, 0, SWP_NOMOVE + SWP_NOSIZE

one more thing i am new to VB and VB editor. i want to all controls in a dialog to move collectively, one method is to select them one by one but i want to select all and then move them to make room for new dialog –

thanks

H H
  • 263,252
  • 30
  • 330
  • 514
PUG
  • 4,301
  • 13
  • 73
  • 115

2 Answers2

0

The first line of your code snippet - doesn't it set the size of Main2? To 3900 x 5010? And then a few lines later you move the form again (to exactly where it is) for no good reason.

I'm a little thrown off by all the \ - should they be / ? Did you type this or paste this?

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
  • one more thing i am new to VB and VB editor. i want to all controls in a dialog to move collectively, one method is to select them one by one but i want to select all and then move them to make room for new dialog – PUG Aug 03 '10 at 12:39
  • \ is the integer division operator in VB. – MarkJ Aug 03 '10 at 13:55
  • @jaminator hold down the control key and you can select multiple controls. I hope you are using version control! – MarkJ Aug 03 '10 at 13:57
  • thanks for the reply Mark but as i stated in my above comment "one more thing i am new to VB and VB editor. i want to all controls in a dialog to move collectively, one method is to select them one by one but i want to select all and then move them to make room for new dialog" I KNOW HOW TO SELECT CONTROLS ONE BY ONE I WAS LOOKING FOR A METHOD TO SELECT ALL AT ONCE – PUG Aug 03 '10 at 16:32
  • 1
    In the IDE? just click-drag over the controls or ctrl+A, then ctrl+arrow to move neatly. – Alex K. Aug 03 '10 at 16:41
  • Thanks @MarkJ I've done plenty of VB and somehow never saw that before. – Kate Gregory Aug 03 '10 at 19:09
  • in the ide i want to undo changes but pressing ctrl z doesnt do anything. help needed – PUG Aug 05 '10 at 10:37
0

Try to make the position of the control relative to the Top and Left properties of the form. This way it will always be at the same position no matter what the size of the form is.

Dia
  • 155
  • 8