473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Implicit conversion warning and

I have a subroutine that I modified from code I found in this forum
(thanks). I'll include it below for public use, and to illustrate my
problem. The sub accepts a ListBox control and an enumeration. It
creates a datasource from the enum and sets the ListBox to use the
datasource. If I pass a ComboBox (which is derived from ListBox) into
the sub, I get a warning about the implicit conversion back to a
ComboBox when the Sub exits. Is there a way to avoid this warning?
Here is the Sub:

Private Shared Sub LoadEnumIntoLC(ByVal typedata As Type, _
ByRef lc As ListControl)
Dim dt As New DataTable
dt.Columns.Add("Display", GetType(String))
dt.Columns.Add("Value", typedata)

For Each obj As Object In [Enum].GetValues(typedata)
Dim row As DataRow = dt.NewRow
row("Display") = obj.ToString()
row("Value") = obj
dt.Rows.Add(row)
Next

lc.DataSource = dt
lc.DisplayMember = "Display"
lc.ValueMember = "Value"
End Sub

Nov 21 '05 #1
3 1318
Note: I meant to refer to a ListControl, not a ListBox. Both ListBox
and ComboBox are derived from ListControl.

Nov 21 '05 #2
"bamapookie" <ba********@gmail.com>'s wild thoughts were
released on 20 May 2005 08:19:01 -0700 bearing the following
fruit:
Note: I meant to refer to a ListControl, not a ListBox. Both ListBox
and ComboBox are derived from ListControl.


And how are you calling that routine?

Jan Hyde (VB MVP)

--
You feel stuck with your debt if you can't budge it. (Karen Mascew)

[Abolish the TV Licence - http://www.tvlicensing.biz/]

Nov 21 '05 #3
Friend WithEvents cbWindowStyle As System.Windows.Forms.ComboBox
' ProcessWindowStyle is the Enum System.Diagnostics.ProcessWindowStyle

LoadEnumIntoLC(GetType(ProcessWindowStyle), cbWindowStyle)

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: buda | last post by:
Let me see if I got this :) 1. I know the rules for type conversions in arithmetic expressions 2. I know that an implicit type conversion is done at assignment, so float x = 1.23; int t = (int)...
36
by: Chad Z. Hower aka Kudzu | last post by:
I have an implicit conversion set up in an assembly from a Stream to something else. In C#, it works. In VB it does not. Does VB support implicit conversions? And if so any idea why it would work...
82
by: robert bristow-johnson | last post by:
here is a post i put out (using Google Groups) that got dropped by google: i am using gcc as so: $ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure...
12
by: robert bristow-johnson | last post by:
presently using linux gcc: $ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- infodir=/usr/share/info...
17
by: arnuld | last post by:
I have checked the FAQ: http://c-faq.com/malloc/mallocnocast.html FAQ discusses a special case when programmer has forgotten to do #include <stdlib.h>. I am including this header and I am not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
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
1
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.