Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use COMBOBOX Control in VB.NET

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Xiaobian to share with you how to use COMBOBOX control in VB. NET, I believe most people still do not know how to share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Visual Basic. NET is an object-oriented intermediate interpreted language based on Microsoft. NET Framework, which can be regarded as an upgraded version of Visual Basic on the. Net Framework platform, with enhanced object-oriented support. However, due to the large changes, VB.net's backward compatibility with VB is not good, causing a lot of controversy in the industry.

Most VB. NET programmers use Visual Studio. Net as an IDE (integrated development environment). SharpDevelop is another open source IDE available. VB. NET requires the. Net Framework platform to execute.

Not long ago, a friend posted, looking for color options VB. NET COMBOBOX control production methods, after testing, finishing out, for reference only.

Private Sub filllistboxwithcolors()

Me.ComboBox1.DrawMode = DrawMode.OwnerDrawFixed

Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

Me.ComboBox1.ItemHeight = 15

'Avoid flashing initiupdate

Me.ComboBox1.BeginUpdate()

ComboBox1.Items.Clear()

Dim pi As Reflection.PropertyInfo

For Each pi In GetType(Color).GetProperties(Reflection.BindingFlags.

Public Or Reflection.BindingFlags.Static)

Me.ComboBox1.Items.Add(pi.Name)

Next

ComboBox1.EndUpdate()

End Sub

Private Sub ComboBox1_DrawItem(ByVal sender As Object,

ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem

If e.Index 128 * 3 Then

b2 = Brushes.Black

Else

b2 = Brushes.White

End If

e.Graphics.DrawString(colorname, Me.ComboBox1.Font, b2, rect.X, rect.Y)

End Sub

Private Sub Form1_Load

(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

filllistboxwithcolors()

End Sub

The above is "VB. NET how to use COMBOBOX control" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report