Abhishek Saha
Abhishek Saha

Reputation: 2564

VB Chat Interface - Displaying Users

I am new to Visual Basic and trying to get around in developing a good gui for a chat interface. I can understand the language as i have been using php and java from quite sometime.

Requirement

Basically i am trying to develop a interface which will show a list of users and along with that display a status (online/offline). My users will reside in mysql database. On clicking the user i want some actions to happen.

Question

I see there is datagrid, listview,listbox but not sure which one to use. Also is it a good idea to display the users by directly quering the mysql database or by accessing a php script which runs few queries and gives the data?

Upvotes: 1

Views: 475

Answers (1)

Steven Doggart
Steven Doggart

Reputation: 43743

The ListBox control would not be a great option since it doesn't easily support multiple columns. The ListView control in Details view is a great option. I think it looks and works nicer than a DataGrid, but it doesn't natively support multi-line items. If you need multi-line items, the DataGrid control may be your best choice. Another option, which would give you more flexibility, would be to use a LayoutPanel control to display a vertical list of your own UserControl. You could design the UserControl anyway you want meaning you could fully control the size, look, and layout of each item in the list without being constrained by the list control.

As far as getting the data, that depends. If the database is always on the LAN and performance is important, then each client should go directly to the database. Otherwise, getting the data from a php script, web service, or WCF service would be a much better choice.

Rather than using the TableLayoutPanel, I would recommend using the FlowLayoutPanel with the FlowDirection property to TopDown and the AutoScroll property set to True. Then, to add a control dynamically, you could do something like this:

Dim item As New MyUserControl()
' Set properties of user control
FlowLayouPanel1.Controls.Add(item)

Upvotes: 1

Related Questions