VB to C# converter

E

esha

I tried several online converters. In many case they do the job, but
sometimes give some mess. I think that all converters I know are old, were
created for VS 2003 and do not understand new stuff from VS 2005. For
instance this block containing Using was not converted by anyone:

Public Shared Function GetSiteSettings() As SiteSettings
Using connection As New
SqlConnection(ConfigurationManager.ConnectionStrings("Personal").ConnectionString)
Using command As New SqlCommand("site_GetSiteSettings", connection)
command.CommandType = CommandType.StoredProcedure
connection.Open()
Dim settings As New SiteSettings(0, "", "", "", "", "", "", "",
0, 0, "", 0, "", "")
Using reader As SqlDataReader = command.ExecuteReader()
Do While (reader.Read())
settings = New SiteSettings(CInt(reader("SiteID")),
CStr(reader("SiteName")), CStr(reader("SiteSlogan")),
CStr(reader("SitePageTitle")), CStr(reader("MetaDescription")),
CStr(reader("MetaKeywords")), CStr(reader("ThemeName")),
CStr(reader("CopyrightCredits")), CInt(reader("EnableRegistration")),
CInt(reader("EnableUserThemes")), CStr(reader("SMTP")),
CInt(reader("RequiresAuthentication")), CStr(reader("AuthUsername")),
CStr(reader("AuthPassword")))
Loop
End Using
Return settings
End Using
End Using

Does anybody know any online converter written for VS 2005?

Thank you
Esha
 
E

Esha

Thank you Seth
What's wrong with crossposting? For instance my current question is related
to several newsgroups, so maybe one of the members of one of the groups has
an answer.
Sorry, I just do not know what and how I affect by crosspostings.

Esha
 
P

Peter Duniho

Esha said:
Thank you Seth
What's wrong with crossposting? For instance my current question is
related to several newsgroups, so maybe one of the members of one of the
groups has an answer.
Sorry, I just do not know what and how I affect by crosspostings.

I would amend his suggestion to just say that one ought to cross-post
carefully, and judiciously.

In your particular case, I would say that the .csharp and .vb newsgroups
both seem on-topic and appropriate. But it's not clear to me that the
..general newsgroup was.

I very much *disagree* with his suggestion to wait a day or say after
posting in one newsgroup and then post to a different one to see if you get
a reply there. If there is indeed another newsgroup in which it's
appropriate to post, there's no problem cross-posting to that newsgroup as
well. Conversely, if no other newsgroup is an appropriate target for a
cross-post, no other newsgroup is appropriate for posting the same question
at a later time.

Minimal cross-posting can work very well, and is much more efficient use of
the newsgroups than "multi-posting" (that is, posting the same message in
different newsgroups at different times). When cross-posting, just the one
message winds up being sent, and people who read multiple newsgroups need
only read the message once (any decent newsreader will mark the message as
read in all newsgroups, once it's been read in just one).

Excessive cross-posting can be a problem in that it allows some topics to
bleed into inappropriate newsgroups, increasing the noise-to-signal ratio of
the off-topic newsgroups. So one should certainly be careful when
cross-posting. But there's no reason to refrain from it altogether.

I know that personally, one thing I've found is that a LOT of questions that
are really just .NET Framework questions get posted here in the .csharp
newsgroup. In fact, just as a rough guess, it seems like more than half the
questions in the .csharp newsgroup have nothing to do with the language
itself.

IMHO, this is inappropriate use of the newsgroup, but it's clearly the
community standard and I'm certainly not going to be the one to try to
change things. :) At the same time, it's clear that the actual
m.p.dotnet.framework newsgroup (where those sorts of questions seem more
on-topic to me) gets much less traffic than this one, and possibly has lower
readership as well. So when I have what is essentially a
language-independent framework question, I still cross-post to this
newsgroup, because that's where the action appears to be.

Anyway, that's a long way of saying that I think you could have left off
m.p.dotnet.general, but otherwise I personally see nothing wrong with your
cross-posting, and I doubt most other people do either.

Pete
 
E

Esha

Great ANSWER !!!
Thank you Peter

Esha

Peter Duniho said:
I would amend his suggestion to just say that one ought to cross-post
carefully, and judiciously.

In your particular case, I would say that the .csharp and .vb newsgroups
both seem on-topic and appropriate. But it's not clear to me that the
.general newsgroup was.

I very much *disagree* with his suggestion to wait a day or say after
posting in one newsgroup and then post to a different one to see if you
get a reply there. If there is indeed another newsgroup in which it's
appropriate to post, there's no problem cross-posting to that newsgroup as
well. Conversely, if no other newsgroup is an appropriate target for a
cross-post, no other newsgroup is appropriate for posting the same
question at a later time.

Minimal cross-posting can work very well, and is much more efficient use
of the newsgroups than "multi-posting" (that is, posting the same message
in different newsgroups at different times). When cross-posting, just the
one message winds up being sent, and people who read multiple newsgroups
need only read the message once (any decent newsreader will mark the
message as read in all newsgroups, once it's been read in just one).

Excessive cross-posting can be a problem in that it allows some topics to
bleed into inappropriate newsgroups, increasing the noise-to-signal ratio
of the off-topic newsgroups. So one should certainly be careful when
cross-posting. But there's no reason to refrain from it altogether.

I know that personally, one thing I've found is that a LOT of questions
that are really just .NET Framework questions get posted here in the
.csharp newsgroup. In fact, just as a rough guess, it seems like more
than half the questions in the .csharp newsgroup have nothing to do with
the language itself.

IMHO, this is inappropriate use of the newsgroup, but it's clearly the
community standard and I'm certainly not going to be the one to try to
change things. :) At the same time, it's clear that the actual
m.p.dotnet.framework newsgroup (where those sorts of questions seem more
on-topic to me) gets much less traffic than this one, and possibly has
lower readership as well. So when I have what is essentially a
language-independent framework question, I still cross-post to this
newsgroup, because that's where the action appears to be.

Anyway, that's a long way of saying that I think you could have left off
m.p.dotnet.general, but otherwise I personally see nothing wrong with your
cross-posting, and I doubt most other people do either.

Pete
 
C

Cor Ligthert [MVP]

Rowe,

What you suggest is multiposting. We don't like that in these dotnet
newsgroups. Crossposting gives us the change to see if it is answered
already in another newsgroup, therefore please don't ask for multiposting.

In my idea is this a sample of a perfect crossposted message.

Cor
 
M

Michael A. Covington

Esha said:
Thank you Seth
What's wrong with crossposting? For instance my current question is
related to several newsgroups, so maybe one of the members of one of the
groups has an answer.
Sorry, I just do not know what and how I affect by crosspostings.

Esha

In fact, traditional netiquette guides say to cross-post rather than posting
separately in different newsgroups. Crossposting is bad only when it is
indiscriminate.

Particularly on microsoft.public, it is hard to tell which of several
similarly named groups will be the active ones. And this is genuinely a
two-language question (VB and C#).
 
R

rowe_newsgroups

Sorry all, I didn't mean to start anything - I was under the impression
that both cross and multi posting where to be avoided whenever
possible. After reading your comments however, I see I was clearly in
the wrong.

Sorry Esha! I'll be quiet now :)

Thanks,

Seth Rowe
 
A

AMDRIT

A lot of posts, but only one suggestion to solving the actual question. I
don't have a suggestion to the question either, just musing over the thread.
 
G

Guest

Can't help you with an online converter that'll do this, but our converter
(Instant C#) produced the following - note that some items are out of
context, so some heuristics are used by the converter in these cases:

public static SiteSettings GetSiteSettings()
{
using (SqlConnection connection = new
SqlConnection(ConfigurationManager.ConnectionStrings["Personal"].ConnectionString))
{
using (SqlCommand command = new SqlCommand("site_GetSiteSettings",
connection))
{
command.CommandType = CommandType.StoredProcedure;
connection.Open();
SiteSettings settings = new SiteSettings(0, "", "", "", "", "", "", "",
0, 0, "", 0, "", "");
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
settings = new SiteSettings(System.Convert.ToInt32(reader["SiteID"]),
System.Convert.ToString(reader["SiteName"]),
System.Convert.ToString(reader["SiteSlogan"]),
System.Convert.ToString(reader["SitePageTitle"]),
System.Convert.ToString(reader["MetaDescription"]),
System.Convert.ToString(reader["MetaKeywords"]),
System.Convert.ToString(reader["ThemeName"]),
System.Convert.ToString(reader["CopyrightCredits"]),
System.Convert.ToInt32(reader["EnableRegistration"]),
System.Convert.ToInt32(reader["EnableUserThemes"]),
System.Convert.ToString(reader["SMTP"]),
System.Convert.ToInt32(reader["RequiresAuthentication"]),
System.Convert.ToString(reader["AuthUsername"]),
System.Convert.ToString(reader["AuthPassword"]));
}
}
return settings;
}
}
}

--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
 
C

Cor Ligthert [MVP]

Amdrit,

We are probably all sure than David answers this kind of questions.

:)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top