03-10-2003, 05:00 PM | #11 | |
Lord Ao
Join Date: March 3, 2001
Location: London, England
Age: 30
Posts: 2,023
|
Quote:
|
|
03-13-2003, 12:36 AM | #12 | |
Jack Burton
Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
|
Ok, i`ve been fiddling round with it a fair bit, and all that seems to be wrong is it being fired at form load.
For the record, the *exact* error is - Quote:
[ 03-13-2003, 12:37 AM: Message edited by: LennonCook ] |
|
03-13-2003, 01:36 AM | #13 |
Ra
Join Date: March 11, 2001
Location: Ant Hill
Age: 49
Posts: 2,397
|
Well if you want a control to have focus as soon as the form loads you could just set the TabIndex of that control to 0.
edit> you can zip and email me the files if you want. [ 03-13-2003, 01:36 AM: Message edited by: Djinn Raffo ] |
03-13-2003, 01:40 AM | #14 |
Ra
Join Date: March 11, 2001
Location: Ant Hill
Age: 49
Posts: 2,397
|
OK i did some searching and the problem you are having is that the control is not visible yet.
Put these events in a new form (i copy this from a thread at deja.com) and run it. Check your immediate pane for the debug.prints to see what is happening.. '============ Option Explicit Private Sub Form_Activate() On Error Resume Next Text2.SetFocus If Err.Number = 0 Then Debug.Print "Form_Activate:Success" Else Debug.Print "Form_Activate:Failed" End If Err.Clear End Sub Private Sub Form_GotFocus() On Error Resume Next Text2.SetFocus If Err.Number = 0 Then Debug.Print "Form_GotFocus:Success" Else Debug.Print "Form_GotFocus:Failed" End If Err.Clear End Sub Private Sub Form_Initialize() On Error Resume Next Text2.SetFocus If Err.Number = 0 Then Debug.Print "Form_Initialize:Success" Else Debug.Print "Form_Initialize:Failed" End If Err.Clear End Sub Private Sub Form_Load() On Error Resume Next Text2.SetFocus If Err.Number = 0 Then Debug.Print "Form_Load:Success" Else Debug.Print "Form_Load:Failed" End If Err.Clear End Sub ''''''''''' [ 03-13-2003, 01:50 AM: Message edited by: Djinn Raffo ] |
03-13-2003, 02:06 AM | #15 |
Jack Burton
Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
|
*slaps forehead* All I needed was to make it ignore that error, because realy it should have done it. There`s a reason, after all, that they included as part of the language "On Error Resume Next"...
|
03-13-2003, 02:15 AM | #16 |
Lord Ao
Join Date: June 24, 2002
Location: Nevernever Land
Age: 50
Posts: 2,002
|
Oh, duh! You are trying to set focus to the control from _Load. Again check out the help files. VBs help is pretty good usually. But, anyway, to sum up. Your form at the _Load event is loaded, but not visible. This means that the form object has been created, and all child objects have been created, but they are not displayed. You can access any object's properties or methods, but you can only set focus to visible objects. The place to set focus when first loading a form is the _Activate event (another place is the _GotFocus event). This is the event that fires when the form is made visible, but before it has focus. Be warned though that code here gets called EVERY time the form is made visible (switching to another application and back to this one causes this for example). If all you want to do is have a default control have focus on form load, give it a .tabindex=0. you can do this from the properties page, or in code (even in _Load).
Hope this makes some sense to you. If you want me to look at your code, pm me.
__________________
[url]\"http://www.duryea.org/pinky/gurkin.wav\" target=\"_blank\">AYPWIP?</a> .... <img border=\"0\" alt=\"[1ponder]\" title=\"\" src=\"graemlins/1ponder.gif\" /> <br />\"I think so Brain, but isn\'t a cucumber that small called a gherkin?\"<br /><br />Shut UP! Pinky! |
03-13-2003, 03:24 AM | #17 |
Jack Burton
Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
|
Two more questions...
1) Is it possible to automatically select the text in the textbox after you press something ?? 2) I`ve been challenged and need a bit of help... anyone have ideas on how to write a program that converts between decimal and hex ?? |
03-13-2003, 03:39 AM | #18 |
Lord Ao
Join Date: June 24, 2002
Location: Nevernever Land
Age: 50
Posts: 2,002
|
1. Yes, there is a selected property of the textbox. Check help for implementation, cuz I don't have access at the moment.
2. Is this for a mental exersize? I think there may be some built in functions to help with this .... If not, remember: A decimal number is cn x 10^n + ...... + c2 x 10^2 + c1 x 10^1 + c0 (technically x 10^0 which is just 1) where c has a range of 0-9. A hex number is yn x 16^n + ...... + y1 x 16^1 + y0 where y has a range of 0-F Try a recurisve function that takes a long parm and returns a string. Do you see an algorithm appearing yet? [ 03-13-2003, 03:42 AM: Message edited by: Night Stalker ]
__________________
[url]\"http://www.duryea.org/pinky/gurkin.wav\" target=\"_blank\">AYPWIP?</a> .... <img border=\"0\" alt=\"[1ponder]\" title=\"\" src=\"graemlins/1ponder.gif\" /> <br />\"I think so Brain, but isn\'t a cucumber that small called a gherkin?\"<br /><br />Shut UP! Pinky! |
03-13-2003, 11:56 PM | #19 |
Jack Burton
Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 37
Posts: 5,452
|
Ok, what`s a recursive function ?:|?
|
03-14-2003, 12:55 AM | #20 |
Lord Ao
Join Date: June 24, 2002
Location: Nevernever Land
Age: 50
Posts: 2,002
|
A function that calls itself.
ex. code:function Factorial(by val x as integer) as long[/QUOTE]this function will call itself until x=0 then start returning values.
__________________
[url]\"http://www.duryea.org/pinky/gurkin.wav\" target=\"_blank\">AYPWIP?</a> .... <img border=\"0\" alt=\"[1ponder]\" title=\"\" src=\"graemlins/1ponder.gif\" /> <br />\"I think so Brain, but isn\'t a cucumber that small called a gherkin?\"<br /><br />Shut UP! Pinky! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Another Video Card Question becomes Antivirus Question!!! | Bahamut | General Conversation Archives (11/2000 - 01/2005) | 19 | 12-27-2003 11:40 PM |
One BIZZZARE question and one normal everyday question | Sythe | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 3 | 09-10-2002 02:44 AM |
Early ch6 question - poss spoiler info in question... | Fljotsdale | Baldurs Gate II Archives | 5 | 03-18-2001 12:33 AM |
Dragon spire crystal question + question about Giant killing for the warriorguild | Malakez | Wizards & Warriors Forum | 4 | 02-20-2001 03:52 PM |
spell lvl question, buying spells question, and role ascension question | Paupa | Wizards & Warriors Forum | 1 | 12-31-2000 04:59 PM |