Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 16, 2017 4:20 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Add new row on last row
PostPosted: Tue Feb 26, 2013 10:29 pm 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
Location: Indonesia
Dim o as integer
For o=listbox1.listcount downto 0
if o<listbox1.listcount then
'Listbox1.Cell(o,2)=Listbox1.Cell(o,2)+"*"
ListBox1.AddRow ""
listBox1.cell(listBox1.lastindex,2)="Disc 10%"
dim a,b as Double
dim c,d as Double
// harga x diskon , d=harga-(hrga x diskon
a=CDbl(ListBox1.Cell(Listbox1.LastIndex, 6))
b=10
c=(a*b)/100*-1
listBox1.cell(listBox1.lastindex,5)=format(c,"-###,##0")
end if
next


I was trying to add a discount on a last row, but it print discount all item on last row.
What I need is every I click the button to add new row, it automatically add new row on last.

the result what I had now is,


Apple 10,000
orange 5,000
disc 10% 100
disc 10% 50


but what I'm expected is ,

Apple 10,000
disc 10% 100
orange 5,000
disc 10% 50

any helps..?

thanks

Regards,
Rivo


Top
 Profile  
Reply with quote  
 Post subject: Re: Add new row on last row
PostPosted: Tue Feb 26, 2013 10:46 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
Rivo wrote:
Dim o as integer
For o=listbox1.listcount downto 0
if o<listbox1.listcount then
'Listbox1.Cell(o,2)=Listbox1.Cell(o,2)+"*"
ListBox1.AddRow ""
listBox1.cell(listBox1.lastindex,2)="Disc 10%"
dim a,b as Double
dim c,d as Double
// harga x diskon , d=harga-(hrga x diskon
a=CDbl(ListBox1.Cell(Listbox1.LastIndex, 6))
b=10
c=(a*b)/100*-1
listBox1.cell(listBox1.lastindex,5)=format(c,"-###,##0")
end if
next


I was trying to add a discount on a last row, but it print discount all item on last row.
What I need is every I click the button to add new row, it automatically add new row on last.

the result what I had now is,


Apple 10,000
orange 5,000
disc 10% 100
disc 10% 50


but what I'm expected is ,

Apple 10,000
disc 10% 100
orange 5,000
disc 10% 50

any helps..?

thanks

Regards,
Rivo


Dont "add row" as that just adds to the end of the list
You probably need to "insert" rows

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Add new row on last row
PostPosted: Tue Feb 26, 2013 11:14 pm 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
Location: Indonesia
thanks..
its solved ;)


regards,
Rivo


Top
 Profile  
Reply with quote  
 Post subject: Re: Add new row on last row
PostPosted: Thu Feb 28, 2013 5:51 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
10% of 10,000 is 1,000, not 100 as in your expected result?

The same applies for your second expected result :)

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: Add new row on last row
PostPosted: Sat Mar 02, 2013 6:29 am 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
Location: Indonesia
sorry, its typed by mistake.


thanks ;)

Regards,
Rivo


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group