Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,248 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,206 people online right now. Registration is fast and FREE... Join Now!




how to solve this problem in vbdotnet2008

 
Reply to this topicStart new topic

how to solve this problem in vbdotnet2008

prigupta2
11 Oct, 2008 - 02:39 AM
Post #1

New D.I.C Head
*

Joined: 11 Oct, 2008
Posts: 5

Function Get_ListIndex(ByVal BoxCombo As Control, ByVal srchtxt As String) As Single
Dim iCount As Single
Dim nItem As Single
nItem = BoxCombo.ListCount

For iCount = 0 To nItem
If (BoxCombo.List(iCount) = srchtxt) Then
Exit For
End If
Next
Get_ListIndex = iCount

End Function

error :------- ListCount is not a member of System.Windows.Forms..Control

User is offlineProfile CardPM
+Quote Post

Damage
RE: How To Solve This Problem In Vbdotnet2008
11 Oct, 2008 - 03:40 AM
Post #2

D.I.C Addict
Group Icon

Joined: 5 Jun, 2008
Posts: 738



Thanked: 7 times
Dream Kudos: 75
My Contributions
is boxcombo a list box or a combo box?
if it's a list box then

CODE

nItem = BoxCombo.items.count

User is offlineProfile CardPM
+Quote Post

magicmonkey
RE: How To Solve This Problem In Vbdotnet2008
11 Oct, 2008 - 11:48 AM
Post #3

D.I.C Regular
***

Joined: 12 Sep, 2008
Posts: 413



Thanked: 68 times
My Contributions
You are declaring you BoxCombo as a Control in your function, you should declare is as a listbox, or what ever the control really is in order to have access to its properties.
User is offlineProfile CardPM
+Quote Post

prigupta2
RE: How To Solve This Problem In Vbdotnet2008
12 Oct, 2008 - 09:24 PM
Post #4

New D.I.C Head
*

Joined: 11 Oct, 2008
Posts: 5

QUOTE(prigupta2 @ 11 Oct, 2008 - 03:39 AM) *

Function Get_ListIndex(ByVal BoxCombo As Control, ByVal srchtxt As String) As Single
Dim iCount As Single
Dim nItem As Single
nItem = BoxCombo.ListCount

For iCount = 0 To nItem
If (BoxCombo.List(iCount) = srchtxt) Then
Exit For
End If
Next
Get_ListIndex = iCount

End Function

error :------- ListCount is not a member of System.Windows.Forms..Control



nItem = BoxCombo.items.count is also not supported

User is offlineProfile CardPM
+Quote Post

Bort
RE: How To Solve This Problem In Vbdotnet2008
13 Oct, 2008 - 06:06 AM
Post #5

D.I.C Regular
Group Icon

Joined: 18 Sep, 2006
Posts: 418



Thanked: 4 times
Dream Kudos: 350
My Contributions
What kind of control is BoxCombo?
User is online!Profile CardPM
+Quote Post

Jayman
RE: How To Solve This Problem In Vbdotnet2008
13 Oct, 2008 - 07:10 AM
Post #6

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,926



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
BoxCombo is of type Control, you will need to cast it to the appropriate control type or change the parameter in your function to accept the correct control.
User is offlineProfile CardPM
+Quote Post

stubaum
RE: How To Solve This Problem In Vbdotnet2008
13 Oct, 2008 - 07:54 PM
Post #7

New D.I.C Head
*

Joined: 7 Aug, 2008
Posts: 1

Private Function FindLstValue(ByVal obj As ListBox, ByVal strFind As String, ByVal strField As String) As Integer
FindLstValue = -1
Dim intX As Integer = 0
For Each X As System.Data.DataRowView In obj.Items
If X.Item(strField).ToString = strFind Then
FindLstValue = intX
Exit For
End If
intX = intX + 1
Next
End Function



might have to change obj As ListBox to obj As combobox
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:03AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month