By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,899 Members | 1,230 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,899 IT Pros & Developers. It's quick & easy.

How to do this on C#.NET

scriptick
P: 15
Hello,
I was write a class on VB.NET and i wanna move my project on C#.NET. I know VB.NET class can be converted to DLL.
I also do that but i have a problem with just one line code :

On the class i wrote a code like this :
MyProject.Forms.frmMain.ComboBox1.Items.Add(modKb. Items(i).Name)

More Details :

Expand|Select|Wrap|Line Numbers
  1.     Public Class modLay
  2.         Public Shared Function Add() As Boolean
  3.             Dim flag As Boolean
  4.             Dim directory As String = (myFunctions.VerifyPath(MyProject.Application.Info.DirectoryPath) & "Items")
  5.             If Not MyProject.Computer.FileSystem.DirectoryExists(directory) Then
  6.                 Interaction.MsgBox("'Layouts' folder not found", MsgBoxStyle.Critical, Nothing)
  7.                 ProjectData.EndApp()
  8.             End If
  9.             Dim onlys As ReadOnlyCollection(Of String) = MyProject.Computer.FileSystem.GetFiles(directory, SearchOption.SearchAllSubDirectories, New String() {"*.xml"})
  10.             If (onlys.Count = 0) Then
  11.                 Interaction.MsgBox("No file found under 'Items' folder", MsgBoxStyle.Critical, Nothing)
  12.                 ProjectData.EndApp()
  13.             End If
  14.             modKB.LayNumber = (onlys.Count + 1)
  15.             modKB.Lay = New clsLayouts(((modKB.LayNumber - 2) + 1) - 1) {}
  16.             Dim num2 As Integer = (modKB.LayNumber - 2)
  17.             Dim i As Integer = 0
  18.             Do While (i <= num2)
  19.                 modKB.Lay(i) = New clsLayouts
  20.                 modKB.Lay(i).Init(onlys.Item(i))
  21.                 modKB.Lay(i).Path = onlys.Item(i)
  22.  
  23.                MyProject.Forms.frmMain.ComboBox1.Items.Add(modKB.Lay(i).Name)
  24.  
  25.                 Catch exception1 As Exception
  26.                     ProjectData.SetProjectError(exception1)
  27.                     Dim exception As Exception = exception1
  28.                     ProjectData.ClearProjectError()
  29.                 End Try
  30.                 modKB.Lay(i).ID = i
  31.                 item.Tag = (i + 2)
  32.                 i += 1
  33.             Loop
  34.             Return flag
  35.         End Function


Now my question is :
How to i call this code"genCombo.Items(i).Name" from dll (When i using that dll on C#.NET) ?

I can call the function but how to add item on C#.NET project ?
Sep 4 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.