when I run my project then a msg was shown:
"object doesn't support this property or method"
but when I press ok then the project run. no problem occurred.
Now what I need to do?

Hit CTRL+Break and see which/where code is highlighted. Do you have Option Explicit (Require Variable Declaration) turned on?

Good Luck

If i write 'option explicit' then show a msg:
complie error
veriable not difined
or If I press CTRL+Break then a line highligt. and this is

if from1.windowstate = vbmaximized then
from2.windowstate = vbnormal
end if

I have more line like it. but only 2 like slected. and then end if selected.

Okay, first future reference. In VB's IDE, goto the menu>Tools>Options and put a check in the box next to where it says Require Variable Declaration.

Okay, now for your problem. You are checking Form1's windowstate and setting form2's. Is form2 even loaded? If not then the problem may be that you are trying to access the properties of a form that is not loaded.

But this does not make sense so I have to ask. Are you sure you are using VB6 and not .NET or VBA (Excel, access, word)?

SO, if you are sure that you are using VB6 then goto vb's menu>Progect>References and the first four items should be these in this order...

Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation

Good Luck

when I press a button to open another from. then show this msg.

Just noticed something, you have typed the word "from" and not "form". Did you happen to misspell this?

Second, in design view, are you sure that the form you want to open is named form2?

Third, try...

If Form1.WindowState = vbMaximized Then
  Load Form2
  Form2.WindowState = vbNormal
  Form2.Visible = True
End If

Good Luck

not work. now if i press ctrl then highlight End Sub

No problem it is working for me , i used the code in form resize.

now I remove all code. but when I press that button to show other form then show this msg. in the button the code is " mreport.show". if I press ctrl + break then hightlight end sub.

Don't know what to tell you abu, your original problem "form2.show" being highlighted was more than likely because form2 did not exist. Look in the object window (Project window) on the right and see what you have named your forms. Do you have a form or forms showing like this... formTest(Form1)... if so, the name within the parenthesis () is the file name and the name before the parens is the name you should use in code.

Good Luck

my form name is mreport. no problem with from & form. i write it just like an example. I have many button to show many form. all are ok. but only this form made problem. when I press a button to show then show this msg. when I press ok. then the form show. but no problem happend.

I remove some control and code. now it is ok.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.