Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   How to convert this (http://www.go4expert.com/forums/convert-t859/)

lieweffect 3Jun2006 14:42

How to convert this
 
Can any c# programmer expert help me to convert this vb.net code to c# code

Dim MyItem = ListViewBookRecord.Items.Add(dr("ID".ToString))
With MyItem
.SubItems.Add(dr("bookname".ToString))
.SubItems.Add(dr("authorname".ToString))
.SubItems.Add(dr("booktype".ToString))
.SubItems.Add(dr("price".ToString))

End With


Dim SaveOrEdit As String = ""
Dim Apppath = Application.StartupPath
Dim DatabasePath = Apppath & "\..\bookrecord.mdb;"
Dim ConnString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DatabasePath & _
"Persist Security Info=False"

shabbir 3Jun2006 22:47

Re: How to convert this
 
I am not sure what is ListViewBookRecord but the C# code would be like
Code: C#

ReturnTypeOfAddMethod MyItem = ListViewBookRecord.Items.Add(dr("ID".ToString))
MyItem.SubItems.Add(dr("bookname".ToString))
MyItem.SubItems.Add(dr("authorname".ToString))
MyItem.SubItems.Add(dr("booktype".ToString))
MyItem.SubItems.Add(dr("price".ToString))


lieweffect 4Jun2006 08:27

Re: How to convert this
 
It give me the error:
"The type or namespace name 'ReturnTypeOfAddMethod' could not be found (are you missing a using directive or an assembly reference?)"

shabbir 4Jun2006 22:05

Re: How to convert this
 
I mentioned the reason for the above error also.
Quote:

Originally Posted by shabbir
I am not sure what is ListViewBookRecord but the C# code would be like

Also I used the name of the variable also very self explanatory but then also I will repeat that its a variable of the return type of your add member.


All times are GMT +5.5. The time now is 10:35.