Listview


Author
Message
Rafael
Rafael
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 48, Visits: 216
I have two TabControl.

In second tabControl have a listview

In first tabControl have a textbox where will to be a code for populate listview, how i do for listview populate whith :

Select * from tabpedidocompraitem where code = ( is here a value of textbox Wink

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Rafael (08/26/2008)
I have two TabControl.

In second tabControl have a listview

In first tabControl have a textbox where will to be a code for populate listview, how i do for listview populate whith :

Select * from tabpedidocompraitem where code = ( is here a value of textbox Wink

You would use a custom fill method in the tabpedidocompraitem business object.  Like this:


public void FillByTextBoxValue(string pTextBoxValue)
{
   
SqlCommand cmd = new SqlCommand("SELECT * FROM tabpedidocompraitem WHERE code = @textboxvalue");
    cmd.CommandType =
CommandType.Text;
    cmd.Parameters.AddWithValue(
"@textboxvalue", pTextBoxValue).SqlDbType = SqlDbType.VarChar;
    FillDataTable(cmd);
}

Follow the SF documentation under "ListView Population".  Marvelous step-by-step to help you with the whole setup.

Hope that helps,
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Blush  Sorry...didn't mean to quote your whole post...I was using that as a guide and forgot to delete it before I posted.

Bill

(note to forum admins: it would be nice to have a view of the post to which we are replying...thanks!)

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The other part of the picture is to setup the listview appropriately. This would be a two parter...



1. Obviously you'd set the ListView to use the custom method that Bill mentioned and you'd handle the ListPopulating event of the listview to get the value from the textbox.



2. You'd then need to set the listview to load manually (rather than on form load), by setting the PopulateOnFormLoad property to Manual. Of course then you need to manually fill it. To do this you'd call .Requery() as appropriate. Likely in either the TextBox.Leave event or perhaps when the tab page is activated.



Hope that helps! BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
(note to forum admins: it would be nice to have a view of the post to which we are replying...thanks!)

You do...scroll down and open the last 10 posts in descending order section.

Rafael
Rafael
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 48, Visits: 216
I understand and very very thanks.

I will do in event Leave of textbox, but i have a question.

What is a bether method to used populate of listview ?

Please say me a method that used in populate listview and i search in documentation.

If i have doubt, question in the forum.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Rafael,



Not sure what your asking, if anything. Do you still have a question?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
You do...scroll down and open the last 10 posts in descending order section.




Wow, never noticed that! That's cool! w00t



Thanks for asking Bill...I've often done the quoting thing myself. The last 10 posts is much better. I also noticed that you can also open the complete topic in a new window...even better for those lonnnnng posts.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
You do...scroll down and open the last 10 posts in descending order section.

Whoa. Blink

Thanks! w00t

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
What is a bether method to used populate of listview ?

Please say me a method that used in populate listview and i search in documentation.

You could pass the parameter in the Requery method of the ListView:

MyListView.Requery(myCoolParameter);

But, as I found out over time, it is better to pass the parameter in the ListPopulating event of the ListView (from docs using VB):


Private Sub ListView1_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles ListView1.ListPopulating
    '-- Pass the search text to the FillByLastName() method
    e.Parameters(0).Value = Me.txtSearch.Text
End Sub

Then, whenever you need to refresh the ListView control, it is a simple call to its Requery method:

MyListView.Requery();

No need to remember to pass a parameter since it is handled in the event.  Good stuff.  A "set it and forget it" type of approach.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search