473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Converting VB code to C#

RP
I have to convert this VB code to C#.

[VB Code]
Dim dvProduct As DataView =
CType(sqlDS_Halloween.Select(DataSourceSelectArgum ents.Empty),DataView)

[Attempted C# Code]
DataView dvProduct =
sqlDS_Halloween.Select(DataSourceSelectArguments.E mpty,DataView);

How to convert to CType?

Oct 23 '07 #1
2 1495
"RP" <rp*********@gmail.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
I have to convert this VB code to C#.

[VB Code]
Dim dvProduct As DataView =
CType(sqlDS_Halloween.Select(DataSourceSelectArgum ents.Empty),DataView)

[Attempted C# Code]
DataView dvProduct =
sqlDS_Halloween.Select(DataSourceSelectArguments.E mpty,DataView);

How to convert to CType?
DataView dvProduct = (DataView)
sqlDS_Halloween.Select(DataSourceSelectArguments.E mpty);

--
Anthony Jones - MVP ASP/ASP.NET
Oct 23 '07 #2
or in addition to Anthony's answer, you can do

DataView dvProduct =
sqlDS_Halloween.Select(DataSourceSelectArguments.E mpty,DataView) as
DataView;

This second method differs in that it will return null (=VB Nothing) if the
object is not of the correct type.

Doing

DataView dvProduct =
(DataView)sqlDS_Halloween.Select(DataSourceSelectA rguments.Empty,DataView);

will throw an InvalidCastException if the object returned by Select is not
of type DataView.

"RP" <rp*********@gmail.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
>I have to convert this VB code to C#.

[VB Code]
Dim dvProduct As DataView =
CType(sqlDS_Halloween.Select(DataSourceSelectArgum ents.Empty),DataView)

[Attempted C# Code]
DataView dvProduct =
sqlDS_Halloween.Select(DataSourceSelectArguments.E mpty,DataView);

How to convert to CType?

Oct 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
by: Mary | last post by:
Hi, Does anyone know of any software out there that would convert an application written in VBScript to either VB.NET or C#/C++ quite quickly for me, or will I have to re-write the application...
3
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the...
12
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
7
by: Coleen | last post by:
Does anyone have any good detailed information on the conversion process? We are in the process of converting 2 projects from 2003 to 2005 and have some conversion errors that I can not find...
10
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox...
4
by: screamer81 | last post by:
Hello, I've a SDK functions description for a scanner and I try to convert unmanaged DLL C++ functions to c#. I converted all except one of them. This function is getting a struct parameter. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.