Hi Guys
Can someone correct my code. I am trying to create a third column on a multicolumn combo box but the second column is overwritten with text from two columns (i.e. the second and third).
Here is my Code: - Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
'TODO: This line of code loads data into the 'PolicyInfoDataSet.tblPolicy_Information' table. You can move, or remove it, as needed.
-
Me.TblPolicy_InformationTableAdapter.Fill(Me.PolicyInfoDataSet.tblPolicy_Information)
-
'TODO: This line of code loads data into the 'PolicyInfoDataSet.tblCall_Transactions' table. You can move, or remove it, as needed.
-
Me.TblCall_TransactionsTableAdapter.Fill(Me.PolicyInfoDataSet.tblCall_Transactions)
-
-
Dim Pol As DataTable = PolicyInfoDataSet.tblPolicy_Information
-
PolicyNoComboBox.DataSource = Pol
-
PolicyNoComboBox.DrawMode = DrawMode.OwnerDrawFixed
-
End Sub
-
Private Sub PolicyNoComboBox_DrawItem(sender As Object, e As System.Windows.Forms.DrawItemEventArgs) Handles PolicyNoComboBox.DrawItem
-
' Draw the default background
-
e.DrawBackground()
-
-
' The ComboBox is bound to a DataTable,
-
' so the items are DataRowView objects.
-
Dim drv As DataRowView = CType(PolicyNoComboBox.Items(e.Index), DataRowView)
-
-
' Retrieve the value of each column.
-
Dim PolID As String = drv("ID").ToString()
-
Dim PolNo As String = drv("Prosperity Policy No").ToString()
-
Dim Tel As String = drv("Telephone Cell").ToString()
-
-
-
'-----------------------------------------------------------------------------------------------------------------------
-
-
' Get the bounds for the first column
-
Dim r1 As Rectangle = e.Bounds
-
r1.Width = r1.Width / 3
-
-
' Draw the text on the first column
-
Using sb As SolidBrush = New SolidBrush(e.ForeColor)
-
e.Graphics.DrawString(PolID, e.Font, sb, r1)
-
End Using
-
-
' Draw a line to isolate the columns
-
Using p As Pen = New Pen(Color.Black)
-
e.Graphics.DrawLine(p, r1.Right, 0, r1.Right, r1.Bottom)
-
End Using
-
-
'---------------------------------------------------------------------------------------------------------------
-
-
' Get the bounds for the second column
-
Dim r2 As Rectangle = e.Bounds
-
r2.X = e.Bounds.Width / 3
-
r2.Width = r2.Width / 2
-
-
' Draw the text on the second column
-
Using sb As SolidBrush = New SolidBrush(e.ForeColor)
-
e.Graphics.DrawString(PolNo, e.Font, sb, r2)
-
End Using
-
-
' Draw a line to isolate the columns
-
Using p As Pen = New Pen(Color.Black)
-
e.Graphics.DrawLine(p, r2.Right, 0, r2.Right, r1.Bottom)
-
End Using
-
-
-
'---------------------------------------------------------------------------------------------------------------
-
-
' Get the bounds for the third column
-
Dim r3 As Rectangle = e.Bounds
-
r3.X = e.Bounds.Width / 3
-
r3.Width = r3.Width / 3
-
-
' Draw the text on the third column
-
Using sb As SolidBrush = New SolidBrush(e.ForeColor)
-
e.Graphics.DrawString(Tel, e.Font, sb, r3)
-
End Using
-
-
PolIDTextBox.Text = PolID
-
PhoneNoTextBox.Text = Tel
-
End Sub
0 1285 Sign in to post your reply or Sign up for a free account.
Similar topics
by: DraguVaso |
last post by:
Hi,
The Multi column comboBox is a well spoken control, that a lot of people
desire, and a lot of people buildtheir own. I tested a lot of them, but none
really was what i wanted to have.
But...
|
by: Keith Smith |
last post by:
How can this be done in C#...?
http://www.codeguru.com/Cpp/controls/combobox/multicolumncombos/article.php/c1825/
|
by: jaYPee |
last post by:
I'm wondering why if there is an example of using a multiplecolumn
combobox in datagrid control.
thanks in advance
|
by: Lars Netzel |
last post by:
I have ask this before and I got a link to a solution where you actually
show a new from on top of everything with a listbox in, where you can have
multicolumns.. and that's what I use now.. That...
|
by: Lars Netzel |
last post by:
It seems like more people than me are looking for something like this.. and
I definately see a big benefit having one of these so it's strange to me
that noone has made one.
Is it possible to...
|
by: Aaron Smith |
last post by:
I would like to try to make a combo box have multiple columns. Does
anyone know of a good way to attempt this? I saw a project on
thecodeproject to do this, I just didn't like the way it looked. I...
|
by: |
last post by:
I am sure this has been asked and answered, but here goes anyway...
VS.Net 2005, VB.Net
How can you display more than one field in the displaymember property of a
combobox inside the...
|
by: vijay dahite |
last post by:
can anybody tell me how to write code for multicolumn combobox in vb6.0 plzzzz...
vijay
|
by: Rod Haywood |
last post by:
I'm trying to populate a multicolumn combo box with data from a sql query.
First problem is that I have to click the down arrow in the cbox to see the
first record. How do I change that? Second...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |