Click here to Skip to main content
15,893,588 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Please help a newbie that is totally confused.... Pin
ymilan28-May-09 2:58
ymilan28-May-09 2:58 
GeneralRe: Please help a newbie that is totally confused.... Pin
Jarno Burger28-May-09 3:55
Jarno Burger28-May-09 3:55 
GeneralRe: Please help a newbie that is totally confused.... Pin
ymilan28-May-09 11:57
ymilan28-May-09 11:57 
GeneralRe: Please help a newbie that is totally confused.... Pin
Jarno Burger28-May-09 23:23
Jarno Burger28-May-09 23:23 
QuestionGet the last line from a constantly updating textbox Pin
The Mighty Atom26-May-09 5:21
The Mighty Atom26-May-09 5:21 
AnswerRe: Get the last line from a constantly updating textbox Pin
Luc Pattyn26-May-09 5:45
sitebuilderLuc Pattyn26-May-09 5:45 
GeneralRe: Get the last line from a constantly updating textbox Pin
The Mighty Atom26-May-09 6:59
The Mighty Atom26-May-09 6:59 
GeneralRe: Get the last line from a constantly updating textbox Pin
Luc Pattyn26-May-09 7:14
sitebuilderLuc Pattyn26-May-09 7:14 
Hi,

if your ListBox output needs some formatting, then you have to paint the content yourself: switch its DrawMode to one of the "OwnerDrawn" values and provide a DrawItem handler, wich can be as simple as
public void lb_DrawItem(object sender, DrawItemEventArgs e) {
	ListBox lb=sender as ListBox;
	int index=e.Index;
	if (index<0 || index>=lb.Items.Count) return;
	string s=(string)lb.Items[index];
	// Draw the background of the ListBox control for each item.
	e.DrawBackground();
	g.DrawString(s, font, brush, e.Bounds);
}


assuming each line uses a single format (you need to provide some font and brush; if you create them inside the DrawItem handler, don't forget to dispose them too).

BTW: one nice characteristic of the ListBox is it only calls DrawItem for the lines that are actually visible, so when thousands of lines are present, but only 25 or so are visible at any given time, only those 25 will fire the DrawItem colorization and painting.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

AnswerRe: Get the last line from a constantly updating textbox Pin
Jarno Burger28-May-09 4:10
Jarno Burger28-May-09 4:10 
GeneralRe: Get the last line from a constantly updating textbox [modified] Pin
The Mighty Atom28-May-09 6:36
The Mighty Atom28-May-09 6:36 
GeneralRe: Get the last line from a constantly updating textbox Pin
DidiKunz29-May-09 4:22
DidiKunz29-May-09 4:22 
GeneralRe: Get the last line from a constantly updating textbox Pin
The Mighty Atom1-Jun-09 3:22
The Mighty Atom1-Jun-09 3:22 
GeneralRe: Get the last line from a constantly updating textbox Pin
DidiKunz1-Jun-09 8:01
DidiKunz1-Jun-09 8:01 
GeneralRe: Get the last line from a constantly updating textbox Pin
The Mighty Atom1-Jun-09 8:20
The Mighty Atom1-Jun-09 8:20 
GeneralRe: Get the last line from a constantly updating textbox Pin
DidiKunz1-Jun-09 9:54
DidiKunz1-Jun-09 9:54 
GeneralRe: Get the last line from a constantly updating textbox Pin
The Mighty Atom1-Jun-09 11:02
The Mighty Atom1-Jun-09 11:02 
GeneralRe: Get the last line from a constantly updating textbox Pin
DidiKunz1-Jun-09 20:50
DidiKunz1-Jun-09 20:50 
QuestionHow to insert image in menu bar in visual basic 2003 or 2005 Pin
alokesh_paine26-May-09 3:24
alokesh_paine26-May-09 3:24 
AnswerRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
Jon_Boy26-May-09 5:03
Jon_Boy26-May-09 5:03 
GeneralRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
alokesh_paine27-May-09 2:19
alokesh_paine27-May-09 2:19 
GeneralRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
Dave Kreskowiak27-May-09 3:36
mveDave Kreskowiak27-May-09 3:36 
GeneralRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
DidiKunz29-May-09 4:26
DidiKunz29-May-09 4:26 
GeneralRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
Dave Kreskowiak29-May-09 15:11
mveDave Kreskowiak29-May-09 15:11 
GeneralRe: How to insert image in menu bar in visual basic 2003 or 2005 Pin
DidiKunz29-May-09 22:09
DidiKunz29-May-09 22:09 
Questionvariable memory to release for heap or stack Pin
Pankaj Garg26-May-09 2:11
Pankaj Garg26-May-09 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.