Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Object Reference not set to an instance of an object


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-13-2008, 06:58 PM
Newbie
 
Join Date: Jan 2008
Posts: 5
Send a message via ICQ to monster9999
Arrow Object Reference not set to an instance of an object

Hello,

i´ve got a problem with adding events

my code:

for example: I want to add a Scroolbar ("ScroolBar1") on a TabControl (tbc2)


'ScrollBar1
' Create
ScrollBar1.New1("Form1",0,0,10,245,true)
ScrollBar1.Maximum = 110
ScrollBar1.Minimum = 0
'Add ScroolBar1 on tabControl
tbc2.AddControl(Scrollbar1.ControlRef,0,222,0)

'Event
AddEvent("Scrollbar1",ValueChanged,"ScrollBar1Even tValueChanged")



Sub ScrollBar1EventValueChanged
tbc2Label1.Top = 15 - ScrollBar1.Value
tbc2Label2.Top = 27 - ScrollBar1.Value
tbc2Label3.Top = 59 - ScrollBar1.Value
tbc2Label4.Top = 91 - ScrollBar1.Value
tbc2Label5.Top = 150 - ScrollBar1.Value
tbc2Label6.Top = 162 - ScrollBar1.Value
tbc2Label7.Top = 194 - ScrollBar1.Value
tbc2Label8.Top = 226 - ScrollBar1.Value
tbc2Label9.Top = 278 - ScrollBar1.Value
tbc2LabelA.Top = 130 - ScrollBar1.Value
tbc2LabelB.Top = 265 - ScrollBar1.Value
tbc2LabelC.Top = 317 - ScrollBar1.Value

tbc2textbox2.Top = 39 - ScrollBar1.Value
tbc2textbox3.Top = 71 - ScrollBar1.Value
tbc2textbox4.Top = 105 - ScrollBar1.Value
tbc2textbox5.Top = 174 - ScrollBar1.Value
tbc2textbox6.Top = 206 - ScrollBar1.Value
tbc2textbox7.Top = 238 - ScrollBar1.Value
tbc2textbox8.Top = 290 - ScrollBar1.Value

End Sub

i get the message: object reference not set to an instance


it doesn´t happen only with this event....the same happens with the next event i try to add!


'Textbox "tbc2textbox2"
' Create
AddTextBox("form1","tbc2textbox2",0,0,150,15,"0")
tbc2textbox2.Color = cGray
tbc2textbox2.FontColor = CBlue
' Add TextBox on tabControl
tbc2.AddControl("tbc2textbox2",0,15,39)
tbc2textbox2.BringtoFront
' Events AddEvent("tbc2textbox2",LostFocus,"tbc2textbox2Los tFocus")

Sub tbc2textbox2LostFocus
tbc2LabelA.Text = tbv2textbox2.Text + tbv2textbox3.Text +tbv2textbox4.text
End Sub


I hope someone can help me!




Karl
Reply With Quote
  #2 (permalink)  
Old 01-13-2008, 07:20 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

It looks like you got an extra space in the sub name.
Reply With Quote
  #3 (permalink)  
Old 01-13-2008, 09:55 PM
Newbie
 
Join Date: Jan 2008
Posts: 5
Send a message via ICQ to monster9999
Default

hello,

thank´s for your answer. I suppose, that i unfortunately made this "extra space".

in real there is no space in the sub


AddEvent("Scrollbar1",ValueChanged,"ScrollBar1Even tValueChanged")


it would be a help, when you could tell me, what the error message "object reference not set to an instance" means

Thanks

Karl
Reply With Quote
  #4 (permalink)  
Old 01-13-2008, 09:58 PM
Newbie
 
Join Date: Jan 2008
Posts: 5
Send a message via ICQ to monster9999
Default

i recognize that there still is this extra space posted in my second message... i don´t know why!

so the name of the sub is correct without this space!

AddEvent("Scrollbar1",ValueChanged,"ScrollBar1Even tValueChanged") (without space)
Reply With Quote
  #5 (permalink)  
Old 01-13-2008, 10:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
for example: I want to add a Scroolbar ("ScroolBar1") on a TabControl (tbc2)
As far as I'm aware, it is NOT possible to add a control, to another control (panels excluded)...
So instead of adding the scrool bar to the tabcontrol, why not add it to the form and make it visible when needed, bringing it to front as well?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #6 (permalink)  
Old 01-14-2008, 01:16 AM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 157
Default

Monster, what's the objective here? It looks as though you're trying to scroll through a set of controls; can you give us a little more insight as what you're actually trying to accomplish?

Gary
Reply With Quote
  #7 (permalink)  
Old 01-14-2008, 06:28 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

Please upload your source code (or part of it) as a file.
Reply With Quote
  #8 (permalink)  
Old 01-14-2008, 07:14 PM
Newbie
 
Join Date: Jan 2008
Posts: 5
Send a message via ICQ to monster9999
Default

Hi,

thank´s for your answeres and tries to help me. Here you have the part of the code, which doesn´t work... i hope it will be better to understand
Attached Files
File Type: sbp test2.sbp (1.3 KB, 9 views)
Reply With Quote
  #9 (permalink)  
Old 01-14-2008, 07:51 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

The Sub beginning and end do not match (nested subs are not supported) :
Code:
Sub Globals
    'Declare the global variables here.

End Sub

Sub App_Start
    Form1.Show
    
    'TabControl - für Knopf "Tool-Bilanzanalyse"
       tbc2.New1("Form1",0,0,240,270)
       tbc2.AddTabPage("Aktiva")
       tbc2.AddTabPage("Passiva")
       tbc2.AddTabPage("GuV")
       tbc2.SetColor(0,cgray)
    tbc2.SetColor(1,cgray)
    tbc2.SetColor(2,cgray)
    
    'Bilanzanalyse - AKTIVA
    
    'LABEL


    ' Label "ALabel1"  // "A Anlagevermögen"
        ' Initialisierung
            AddLabel("form1","tbc2Label1",0,0,150,15,"A Anlagevermögen")
            tbc2Label1.Color = cGray
            tbc2Label1.FontColor = cYellow
        ' Platzierung auf TabControl
            tbc2.AddControl("tbc2Label1",0,2,15)
    
    
    'ScrollBar1 auf AKTIVA
        ' Initialisierung
            ScrollBar1.New1("Form1",0,0,10,245,true)
            ScrollBar1.Maximum = 110
            ScrollBar1.Minimum = 0
        'Plazierung auf TabControl
            tbc2.AddControl(Scrollbar1.ControlRef,0,222,0)
        'Event
            AddEvent("Scrollbar1",ValueChanged,"SBE_ValueChanged")
            
Sub SBE_ValueChanged
        tbc2Label1.Top = 15 - ScrollBar1.Value
End Sub    

End Sub
Reply With Quote
  #10 (permalink)  
Old 01-15-2008, 10:56 PM
Newbie
 
Join Date: Jan 2008
Posts: 5
Send a message via ICQ to monster9999
Default

Thank´s
that was the misstake!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I know if an object exists? jesb4ppc Questions & Help Needed 7 05-20-2008 11:57 AM
remove a object paul j Questions & Help Needed 2 12-06-2007 07:40 AM
Explore Object tvrman Basic4ppc Wishlist 2 08-29-2007 07:29 PM
object reference dennishea Questions & Help Needed 6 08-15-2007 05:48 PM
Tab Object anansath Basic4ppc Wishlist 1 06-08-2007 03:58 PM


All times are GMT. The time now is 06:30 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0