Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo in LIst Box ???/ 2

Status
Not open for further replies.

jester4281

IS-IT--Management
Sep 12, 2002
160
US
Is it possible to utilize a memo field in a listbox, without it showing MEMO. I know you can do this in a grid but I want the listbox function.
 
I just tried this, and it ain't showing nothing but "Memo".
If the table has less than 64000 records, dump the memo field into array, and make that array a control's RowSource (don't forget RowSourceType).

I guess, you want MultiSelect, don't you?


Regards,

Ilya
 
no to the multiselect, just need them listed because once they click it then populates another listbox.
 
Hello.

Try putting the memo field in as normal, then editing the data property to say trim()

Code:
trim(myMemoField)

That's what I do

Regards

Griff
Keep [Smile]ing
 
I dont knwo where to try it. Where and how. Do I Do this in the data enviroment. or on a thisform.listbox. some function/
 
Sorry Jester, not meaning to be flippant!

I suppose then you could put it in the forms 'init' method:

Code:
thisform.listbox1.rowsource="trim(mymemofield)"

or something like that.

Does that help?




Regards

Griff
Keep [Smile]ing
 
HOw would i work that if my original was


brandissueresult.issueid,brandid,issue
 
Dump the contents of your table to a cursor and use the cursor instead of the brandissueresult table...here is a sample for you (cut-n-paste the code below into a prg file and run it from within VFP)

PUBLIC oForm
oForm = CREATEOBJECT("clsmemolist")
oForm.show()

DEFINE CLASS clsmemolist AS form
Top = 0
Left = 0
Height = 431
Width = 555
DoCreate = .T.
Caption = "Show Memo in Listbox"
Name = "Form1"

ADD OBJECT list1 AS listbox WITH ;
ColumnCount = 3, ;
ColumnWidths = "50,50,500", ;
RowSourceType = 6, ;
RowSource = "brandissueresult.issueid,brandid,issue", ;
Height = 146, ;
ColumnLines = .T., ;
Left = 37, ;
Top = 60, ;
Width = 480, ;
Name = "List1"

ADD OBJECT list2 AS listbox WITH ;
ColumnCount = 3, ;
ColumnWidths = "50,50,500", ;
RowSourceType = 6, ;
RowSource = "crsShowMemo.issueid,brandid,issue", ;
Height = 134, ;
ColumnLines = .T., ;
Left = 37, ;
Top = 276, ;
Width = 480, ;
Name = "List2"

ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Shows 'Memo'", ;
Height = 17, ;
Left = 37, ;
Top = 27, ;
Width = 81, ;
ForeColor = RGB(0,0,255), ;
Name = "Label1"

ADD OBJECT label2 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Shows first 254 characters of memo", ;
Height = 17, ;
Left = 37, ;
Top = 243, ;
Width = 200, ;
ForeColor = RGB(0,0,255), ;
Name = "Label2"

ADD OBJECT label3 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Issueid", ;
Height = 17, ;
Left = 37, ;
Top = 260, ;
Width = 43, ;
ForeColor = RGB(128,0,0), ;
Name = "Label3"

ADD OBJECT label4 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Brandid", ;
Height = 17, ;
Left = 92, ;
Top = 260, ;
Width = 45, ;
ForeColor = RGB(128,0,0), ;
Name = "Label4"

ADD OBJECT label5 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Issue", ;
Height = 17, ;
Left = 145, ;
Top = 260, ;
Width = 33, ;
ForeColor = RGB(128,0,0), ;
Name = "Label5"

ADD OBJECT label6 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Issueid", ;
Height = 17, ;
Left = 37, ;
Top = 44, ;
Width = 43, ;
ForeColor = RGB(128,0,0), ;
Name = "Label6"

ADD OBJECT label7 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Brandid", ;
Height = 17, ;
Left = 92, ;
Top = 44, ;
Width = 45, ;
ForeColor = RGB(128,0,0), ;
Name = "Label7"

ADD OBJECT label8 AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "Issue", ;
Height = 17, ;
Left = 145, ;
Top = 44, ;
Width = 33, ;
ForeColor = RGB(128,0,0), ;
Name = "Label8"

PROCEDURE Load
*!* Set up a fake cursor and pretend it is the table (this is just for illustration of solution
CREATE CURSOR brandissueresult (issueid I,brandid I,issue M)
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(1,1021,"BLAH blah blah blah blah. BLAH blah blah blah blah. BLAH blah blah blah blah. BLAH blah blah blah blah.")
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(2,1022,"Yack yack yack yack yack. Yack yack yack yack yack. Yack yack yack yack yack. Yack yack yack yack yack.")
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(3,1023,"Talk talk talk talk talk. Talk talk talk talk talk. Talk talk talk talk talk. Talk talk talk talk talk.")
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(4,1024,"Whisper whisper whisper whisper whisper. Whisper whisper whisper whisper whisper. Whisper whisper whisper whisper whisper.")
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(5,1025,"Yell yell yell yell yell. Yell yell yell yell yell. Yell yell yell yell yell. Yell yell yell yell yell.")
INSERT INTO brandissueresult (issueid,brandid,issue) VALUES(6,1026,"Test test test test test. Test test test test test. Test test test test test. Test test test test test.")

*!* The following will make sure that issue memo field is treated as a character field
*!* Please note the 254 length limitation, this is something you will need to consider
SELECT issueid, brandid, Left(issue,254) as issue FROM brandissueresult INTO CURSOR crsShowMemo
ENDPROC

ENDDEFINE


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Which one is the memo?

Assuming it's issue:

Code:
thisform.listbox1.rowsource="brandissueresult.issueid,brandid,trim(issue)"


Regards

Griff
Keep [Smile]ing
 
GriffMG,

Have you tried your suggestion?
thisform.listbox1.rowsource="brandissueresult.issueid,brandid,trim(issue)"

I am using VFP 7 and it gives me a syntax error.



Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
jester4281,

Did you try the example I provided above? Fix is to use a temporary cursor or view and make the field of type character.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
I'll need to build a cursor to test it!

Give me a few minutes.

Regards

Griff
Keep [Smile]ing
 
GriffMG,

Feel free to modify my code above. Expressions cannot be in the field list.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
All set, in my select I did the select issue AS issuenew and then refered to the issuenew in my rowsource, thank you so much
 
Weird, you are right - if you have more than one column, vfp does not like it! with one column it is fine!

I'm gonna play with this!

Regards

Griff
Keep [Smile]ing
 
Well,well...

Code:
thisform.listbox1.rowsource=;
"trim(brandissueresult.issue),issueid,brandid"

is ok, other forms are not!

Wierd as I said!

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top