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 1287 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: 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: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |