Reply
Copper Contributor
agrych
Posts: 34
Country: United States
Message 1 of 9 (912 Views)

ListBox

Using ACT! for Financial Professionals v11

 

I am hoping there is someone out there willing to share VB knowledge with ListBoxes in the ReportDesigner. 

I have aLlistbox, let us call it MonthList, that is a Multiselect Listbox.  I am trying to take each item that is selected and put it into its own string.  I can get one string of everything that is selected with the following VB code:

 

Dim strLst as String

strLst = MonthList1.Text

Custom1.Text = strLst

 

Now Custom1 will display the selected items separated by a semicolon.   I want to take each item that is in Custom1 and put it in it's own string.  So for example, if the MonthList had a multiselection of APR MAY and DEC, strLst will have APR;MAY;DEC.

I would like to be able to have

Custom1.Text show APR

Custom2.Text show MAY

Custom3.Text show DEC

 

Any help would be greatly appreciated.

Please use plain text.
Moderator
mwood
Posts: 1,162
Country: USA
Message 2 of 9 (893 Views)

Re: ListBox

Could we split() the string @ the semicolon and use the values from the array created?

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.
Copper Contributor
agrych
Posts: 34
Country: United States
Message 3 of 9 (888 Views)

Re: ListBox

I had tried that to see if it would parse the first two in the array and it did not work.  Below is the code I used.

 

Dim strLst as String

Dim strMonth() As String

strLst = MonthList1.Text

Custom1.Text = strLst

 

strMonth = Split(strLst,";")
Custom2.Text=strMonth(1)

Custom3.Text=strMonth(2)

Please use plain text.
Moderator
mwood
Posts: 1,162
Country: USA
Message 4 of 9 (884 Views)

Re: ListBox

Forgive me if I'm not understanding something here.

 

If the string strLst looks something like: text1;text2;text3;textn -- and our goal is to have Custom1 through CustomN filled in with the individual strings seperatated by ';' then wouldn't it look something like:

 

strLst = MonthList1.Text

String[] strMonth = strLst.Split(';');

Custom1.Text = strMonth[0];

Custom2.Text = strMonth[1];

CustomN.Text = strMonth[N];

 

Or am I misunderstanding the goal?

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.
Copper Contributor
agrych
Posts: 34
Country: United States
Message 5 of 9 (880 Views)

Re: ListBox

You are understanding my goal perfectly.  However, the code is not working and I have no idea why.

 

When I use the following syntax nothing shows up not even the strLst1 in Custom1.Text.  It is as if ReportDesigner does not like the syntax. 

Dim strLst As String
Dim strMonth() As String
strLst = Frequency1.Text
Custom1.Text=strLst
String[] strMonth = strLst.Split(';');

Custom1.Text=strMonth[0];
Custom2.Text=strMonth[1];
Custom3.Text=strMonth[2];

 

Do you know what version of VB the ReportDesigner uses (VB 6?)?  I tried it with and without the semicolons as well.

 

Please use plain text.
Copper Contributor
agrych
Posts: 34
Country: United States
Message 6 of 9 (878 Views)

Re: ListBox

Dim strLst As String
Dim strMonth() As String
strLst = Frequency1.Text
Custom13.Text=strLst
String[] strMonth = strLst.Split(';');

Custom1.Text=strMonth[0];
Custom2.Text=strMonth[1];
Custom3.Text=strMonth[2];

 

I had a typo in my last post.  I put strLst in Custom13.Text instead of Custom1.Text.

Please use plain text.
Copper Contributor
agrych
Posts: 34
Country: United States
Message 7 of 9 (848 Views)

Re: ListBox

Do you have any other suggestions?  This is real puzzling.

Please use plain text.
Moderator
mwood
Posts: 1,162
Country: USA
Message 8 of 9 (839 Views)

Re: ListBox

You say this isn't working in the report designer. Are you in the Act report designer? Or are you creating a new VB reporting application?

 

Also, the small amount of code I gave was in c#, so the syntax is definitely incorrect in either case, I very rarely use VB so I'm probably not the best resource for syntax issues using it.

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.
Copper Contributor
agrych
Posts: 34
Country: United States
Message 9 of 9 (837 Views)

Re: ListBox

I am in the ACT ReportDesigner.

 

Thank you for trying - I really do appreciate your effort. 

Hopefully someone else out there will know how to do it and be willing to share.

Please use plain text.