Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 C# and 'SQL Server 2005 EE', going from VB to C# ?

Author  Topic 

inkimar
Starting Member

3 Posts

Posted - 2006-03-24 : 06:49:05
Hello!

Doing some C# and trying to access my db.
Following a book from Wrox, they use VB - there is my problem.

How would I translate the following to C# ?

Dim PKvalue As String = FilterInput.Text; // Filterinput är en textbox
DIM Rowlocated AS DataRow = Me.MyDBDataSet.Person.Rows.Find(CType(PKvalue,Integer))
If Not ( RowLocated Is Nothing) Then
MessageBox.Show(CType(Rowlocated(1),String))
Else
MessageBox.Show(PKvalue & " record not located" )
End if

Hopefully you are able to help me.

regards, i

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-03-24 : 06:58:26
http://www.developerfusion.co.uk/Utilities/convertvbtocsharp.aspx


Duane.
Go to Top of Page

inkimar
Starting Member

3 Posts

Posted - 2006-03-24 : 07:52:36
Thank you Duane!
Greatest tip today!

Regards,i

"But if thought corrupts language, language can also corrupt thought." -George Orwell
Go to Top of Page

inkimar
Starting Member

3 Posts

Posted - 2006-03-24 : 08:30:34
Did not manage though these lines:

If Not ( RowLocated Is Nothing) Then
MessageBox.Show(CType(Rowlocated(1),String))
Else
MessageBox.Show(PKvalue & " record not located" )
End if

regards, i

"But if thought corrupts language, language can also corrupt thought." -George Orwell
Go to Top of Page
   

- Advertisement -