Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 117,570 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,798 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



filelistbox

 
Reply to this topicStart new topic

filelistbox

dreamer1980
post 20 Jul, 2008 - 08:50 AM
Post #1


New D.I.C Head

*
Joined: 20 Jul, 2008
Posts: 5

Hi I am trying to use filelistbox which is from the v6 compatability namespace in c#. It works ok but some of the members do not work. I am tying to use filelistbox1.items.count but it comes up with an error. it does work in visual basic. can't undrstand as it part of the .net andif orks in VB should work in c#. what am I doing wrong?
User is offlineProfile CardPM

Go to the top of the page


PixelCard
post 20 Jul, 2008 - 10:02 AM
Post #2


D.I.C Head

Group Icon
Joined: 20 Jun, 2008
Posts: 139



Thanked 3 times

Dream Kudos: 650
My Contributions


Please, post the full code you are using to get more information on the problem.
User is offlineProfile CardPM

Go to the top of the page

dreamer1980
post 20 Jul, 2008 - 10:35 AM
Post #3


New D.I.C Head

*
Joined: 20 Jul, 2008
Posts: 5

I have added a filelistbox to the form and update the path property depending on textbox. This part works ok but I also want to count the files displayed in the listbox using the folloing code.

CODE
int   test = fileListBox1.items.count;


This works fine in VB but when run in C# I get the following error

QUOTE
'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' does not contain a definition for 'items' and no extension method 'items' accepting a first argument of type 'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' could be found (are you missing a using directive or an assembly reference?)


hopefully I have ade it clearer
User is offlineProfile CardPM

Go to the top of the page

PixelCard
post 20 Jul, 2008 - 12:43 PM
Post #4


D.I.C Head

Group Icon
Joined: 20 Jun, 2008
Posts: 139



Thanked 3 times

Dream Kudos: 650
My Contributions


QUOTE(dreamer1980 @ 20 Jul, 2008 - 10:35 AM) *

I have added a filelistbox to the form and update the path property depending on textbox. This part works ok but I also want to count the files displayed in the listbox using the folloing code.

CODE
int   test = fileListBox1.items.count;


This works fine in VB but when run in C# I get the following error

QUOTE
'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' does not contain a definition for 'items' and no extension method 'items' accepting a first argument of type 'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' could be found (are you missing a using directive or an assembly reference?)


hopefully I have ade it clearer


C# is a case-sensitive language, so this:

CODE
int   test = fileListBox1.items.count;


is not equal to this:

CODE
int   test = fileListBox1.Items.Count;


Try the second code snippet.
User is offlineProfile CardPM

Go to the top of the page

dreamer1980
post 20 Jul, 2008 - 02:12 PM
Post #5


New D.I.C Head

*
Joined: 20 Jul, 2008
Posts: 5

QUOTE(PixelCard @ 20 Jul, 2008 - 12:43 PM) *

QUOTE(dreamer1980 @ 20 Jul, 2008 - 10:35 AM) *

I have added a filelistbox to the form and update the path property depending on textbox. This part works ok but I also want to count the files displayed in the listbox using the folloing code.

CODE
int   test = fileListBox1.items.count;


This works fine in VB but when run in C# I get the following error

QUOTE
'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' does not contain a definition for 'items' and no extension method 'items' accepting a first argument of type 'Microsoft.VisualBasic.Compatibility.VB6.FileListBox' could be found (are you missing a using directive or an assembly reference?)


hopefully I have ade it clearer


C# is a case-sensitive language, so this:

CODE
int   test = fileListBox1.items.count;


is not equal to this:

CODE
int   test = fileListBox1.Items.Count;


Try the second code snippet.


Thanks a lot that sorted it. feel realy silly missing that one.

Any ideas why items des not come up in the copletion list?
User is offlineProfile CardPM

Go to the top of the page

PixelCard
post 21 Jul, 2008 - 12:02 AM
Post #6


D.I.C Head

Group Icon
Joined: 20 Jun, 2008
Posts: 139



Thanked 3 times

Dream Kudos: 650
My Contributions


QUOTE
Any ideas why items des not come up in the copletion list?


What completion list? Could you be more specific, please?
User is offlineProfile CardPM

Go to the top of the page

dreamer1980
post 21 Jul, 2008 - 01:10 AM
Post #7


New D.I.C Head

*
Joined: 20 Jul, 2008
Posts: 5

Sorry. When you start typing you get a drop down completion list. When I type in 'filelistbox1.' A list of all the members applicable to filelistbox comes up in a drop down box (also known as intellisence). But for some reason I do not get 'Items' in the drop down box.
User is offlineProfile CardPM

Go to the top of the page

PixelCard
post 21 Jul, 2008 - 04:53 AM
Post #8


D.I.C Head

Group Icon
Joined: 20 Jun, 2008
Posts: 139



Thanked 3 times

Dream Kudos: 650
My Contributions


QUOTE(dreamer1980 @ 21 Jul, 2008 - 01:10 AM) *

Sorry. When you start typing you get a drop down completion list. When I type in 'filelistbox1.' A list of all the members applicable to filelistbox comes up in a drop down box (also known as intellisence). But for some reason I do not get 'Items' in the drop down box.


Looks like the namespace you are trying to use is not available in a C# project.
User is offlineProfile CardPM

Go to the top of the page

dreamer1980
post 21 Jul, 2008 - 05:32 AM
Post #9


New D.I.C Head

*
Joined: 20 Jul, 2008
Posts: 5

QUOTE(PixelCard @ 21 Jul, 2008 - 04:53 AM) *

QUOTE(dreamer1980 @ 21 Jul, 2008 - 01:10 AM) *

Sorry. When you start typing you get a drop down completion list. When I type in 'filelistbox1.' A list of all the members applicable to filelistbox comes up in a drop down box (also known as intellisence). But for some reason I do not get 'Items' in the drop down box.


Looks like the namespace you are trying to use is not available in a C# project.


OK. Thanks a lot for your help.
User is offlineProfile CardPM

Go to the top of the page

PixelCard
post 23 Jul, 2008 - 11:04 AM
Post #10


D.I.C Head

Group Icon
Joined: 20 Jun, 2008
Posts: 139



Thanked 3 times

Dream Kudos: 650
My Contributions


QUOTE(dreamer1980 @ 21 Jul, 2008 - 05:32 AM) *

QUOTE(PixelCard @ 21 Jul, 2008 - 04:53 AM) *

QUOTE(dreamer1980 @ 21 Jul, 2008 - 01:10 AM) *

Sorry. When you start typing you get a drop down completion list. When I type in 'filelistbox1.' A list of all the members applicable to filelistbox comes up in a drop down box (also known as intellisence). But for some reason I do not get 'Items' in the drop down box.


Looks like the namespace you are trying to use is not available in a C# project.


OK. Thanks a lot for your help.


Did you add a reference to Microsoft.VisualBasic.Compatibility to your project? However, I can't see any Items property there.

This post has been edited by PixelCard: 23 Jul, 2008 - 11:17 AM
User is offlineProfile CardPM

Go to the top of the page

djkitt
post 23 Jul, 2008 - 11:44 AM
Post #11


D.I.C Head

**
Joined: 22 May, 2008
Posts: 128



Thanked 13 times
My Contributions


So, it works but doesn't show up on intellisense...

csharp

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic.Compatibility.VB6;


namespace testVBFileList
{
public partial class Form1 : Form
{
FileListBox flb = new FileListBox();

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

flb.Top = 30;
flb.Left = 30;
flb.Height = 200;
flb.Width = 200;
flb.Click +=new EventHandler(flb_Click);
this.Controls.Add(flb);
}
private void flb_Click(object sender, EventArgs e)
{
FileListBox f = (FileListBox)sender;


MessageBox.Show(f.Items.Count.ToString());
}
}
}


This post has been edited by djkitt: 23 Jul, 2008 - 11:47 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 08:27PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month