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.


ListBox_SelectionChanged problem v.6.30


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2008, 08:30 AM
Newbie
 
Join Date: May 2007
Posts: 2
Default ListBox_SelectionChanged problem v.6.30

My application compiled wit Basic4ppc ver. 5.80 works fine on the device (I use Asus A632, WM5). The same code compiled with Basic4ppc ver. 6.30 gives Unexpected Error or Invalid Cast Exeption error. My code is very large but I'm sure the problem is only with ListBox_SelectionChanged events. I made simple code to show you the way I use ListBox_SelectionChanged event. This code gives similar errors after compliation with ver. 6.30 (Compile/Device EXE). Can you help me to find my mistake. What is correct way to use this event with ver. 6.30.
Code:
Sub Globals
    'Declare the global variables here.
    Dim NR(500) As STRING            ' Point name
    Dim X(500),Y(500) As DOUBLE   ' Coordinates
    Dim POINT1,POINT2
    Dim NAME1,NAME2
End Sub
'   ** CALCULATES DISTANCE FROM COORDINATES
Sub App_Start
	Form1.Show
	POINT1=-1
	POINT2=-1	
' testing data 	
	NR(0)=100
	X(0)=52000.0
	Y(0)=35000.0
	For I=1 To 99
	  NR(I)=NR(I-1)+ 1
	  X(I)=X(I-1)+ 50.
	  Y(I)=Y(I-1)+ 60.
	Next I
' show points for selecting	
	For I=0 To 99
             ListBox1.Add(NR(I))
	ListBox2.Add(NR(I))
	Next I 
End Sub

Sub ListBox1_SelectionChanged (Index, Value)  'select first point
    POINT1=Index
    NAME1=Value
    Label6.Text=NAME1
    DIST
End Sub

Sub ListBox2_SelectionChanged (Index, Value)  'select second point
    POINT2=Index
    NAME2=Value
    Label8.Text=NAME2
    DIST
End Sub

Sub Button1_Click
    AppClose
End Sub

Sub DIST
 Dim DX,DY,S
    If POINT1>-1 AND POINT2>-1 Then
       DX=X(POINT1)-X(POINT2)
       DY=Y(POINT1)-Y(POINT2)
       S=DX*DX+DY*DY              ' computed distance
       Label2.Text=Format(Sqrt(S),"F2") 
End If   
End Sub
Thanks
numerus
Attached Files
File Type: sbp Distance.sbp (2.1 KB, 4 views)
Reply With Quote
  #2 (permalink)  
Old 08-14-2008, 09:27 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

There is a bug in the legacy compiler that causing this fault.
This bug will be fixed in the next release.

You have a small typo in the following lines:
Code:
' testing data     
    NR(0)=100
    X(0)=52000.0
    Y(0)=35000.0
    For I=1 To 99
      NR(I)=NR(I-1)+ 1
      X(I)=X(I-1)+ 50. 'Remove the dots
      Y(I)=Y(I-1)+ 60. 

    Next I
The solution is to use the much improved optimized compiler.
Reply With Quote
  #3 (permalink)  
Old 08-14-2008, 10:02 PM
Newbie
 
Join Date: May 2007
Posts: 2
Angry

Hi,
Thanks Erel for the reply.
To tell the true I was waiting for more optimistic diagnosis. It is a pity.

Quote:
Originally Posted by Erel View Post
The solution is to use the much improved optimized compiler.
You are right, but I must take also enduser into consideration who prefers fully functional exe without suplementary installation for his device (I mean .Net 2 for older devices). So, unfortunately probably I must came back to the old version of Basic4ppc.

Quote:
Originally Posted by Erel View Post
This bug will be fixed in the next release.
Maybe patch for version 6.30?

Regards
and thank you for your useful work!

numerus
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


All times are GMT. The time now is 11:44 AM.


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