|
-
Nov 5th, 2007, 03:02 PM
#1
Thread Starter
Addicted Member
What gets selected, when the project is run?
For example, I had a button, but I disabled it in FormLoad. Now a radio button gets activated for no apparant reason...How do I control what gets focus and what doesent?
-
Nov 5th, 2007, 03:07 PM
#2
Re: What gets selected, when the project is run?
use the .SetFocus
like text1.setfocus
its done by the tab order
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 5th, 2007, 03:11 PM
#3
Member
Re: What gets selected, when the project is run?
but do it in the Activate Event rather than the Load.
-
Nov 5th, 2007, 04:05 PM
#4
Thread Starter
Addicted Member
Re: What gets selected, when the project is run?
what if there are no members that I like that have that property, how do I stop anything from being activated?
-----Leave Activate empty 
wait...no, thats not completely right... can someone clear this up for me? how does VB single out the one button I DO NOT want clicked, and clicks it at load?
Last edited by unxzst; Nov 5th, 2007 at 04:17 PM.
-
Nov 5th, 2007, 04:33 PM
#5
Thread Starter
Addicted Member
Re: What gets selected, when the project is run?
Whats going on? I cant even debug this, because when I do - everything works smooth, but if I press run it goes straight for OptionButton_Click(Index As Integer) with a preset index out of nowhere...
-
Nov 5th, 2007, 05:06 PM
#6
Re: What gets selected, when the project is run?
If you don't want to see anything gets focus when the form loads, create a Dummy text box, that has :
tab_index=0, enabled=true, locked=true,
width=0, left=0, border=transparent (or put it outside of viewable area.)
-
Nov 5th, 2007, 05:14 PM
#7
Re: What gets selected, when the project is run?
 Originally Posted by unxzst
How do I control what gets focus and what doesent
TabIndex=0. Whichever control has that property set will be the first to get focus, assuming it is enabled and can get the focus. Otherwise then next control in the tab order will get the focus if it can... Controls that can't receive focus are those that are invisible, those without an hWnd property (i.e., label, image control) and those that are disabled or are in a disabled container.
-
Nov 5th, 2007, 05:15 PM
#8
Re: What gets selected, when the project is run?
Put all your controls on that form in a frame. Set it to borderless and no caption. Then disable the frame and all controls in it will be disabled but look normal.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 5th, 2007, 05:30 PM
#9
Re: What gets selected, when the project is run?
 Originally Posted by RobDog888
Put all your controls on that form in a frame. Set it to borderless and no caption. Then disable the frame and all controls in it will be disabled but look normal.
Or simply put
Option1.Value = False
Option2.Value = False
etc in the form's Activate event.
-
Nov 5th, 2007, 05:33 PM
#10
Re: What gets selected, when the project is run?
@RodDog, your way will make it "look normal" but all controls are disabled, you will need code to enable them.
I think the OP wants no control gets focus when open the form but they must be enabled as normal and ready to be clicked.
By default, as LaVolpe said, the first enabled control (in tab order), if any, will receive focus when the form open, if no enabled control the form will receive focus.
-
Nov 5th, 2007, 05:35 PM
#11
Re: What gets selected, when the project is run?
 Originally Posted by anhn
@RodDog, your way will make it "look normal" but all controls are disabled, you will need code to enable them.
I think the OP wants no control gets focus when open the form but they must be enabled as normal and ready to be clicked.
By default, as LaVolpe said, the first enabled control (in tab order), if any, will receive focus when the form open, if no enabled control the form will receive focus.
That code would just be
Frame1.Enabled = True
-
Nov 5th, 2007, 05:40 PM
#12
Re: What gets selected, when the project is run?
I think if the OP tells us what controls are on the form and what is to be non-selected at form load/activate then it may be easier to suggest. If all controls will need to be deselected or just a few then its easy to just set them all to False or whatever for each control in the activate event. We dont know what the OP is ultimately trying to achieve.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 5th, 2007, 05:43 PM
#13
Re: What gets selected, when the project is run?
@MartinLiss,
Yes, I know it just be "Frame1.Enabled = True" but where to put it and when it will be run. After enable Frame1, the problem will come back.
-
Nov 5th, 2007, 05:45 PM
#14
Re: What gets selected, when the project is run?
It could easily be placed in a button click event if the button is not in the frame but we have no idea what the OP wants / needs so its all unsolveable for now.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 5th, 2007, 05:47 PM
#15
Re: What gets selected, when the project is run?
 Originally Posted by anhn
@MartinLiss,
Yes, I know it just be "Frame1.Enabled = True" but where to put it and when it will be run. After enable Frame1, the problem will come back.
Try it and you'll see that when you enable the frame the option buttons value(s) will not be set to True.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|