convert c#.net page to vb.net

ok I have an entire page in vb.net and now I want to integrate some code from another page but it written in c#.net 

what is the easiest way to convert c#.net to vb.net I tried using www.kamalpatel.net/ConvertCSharp2VB.aspx but it only gave me errors
here is what I am trying to convert let me know if you have any ideas
http://www.nomorepasting.com/paste.php?pasteID=20953
0
TorontoVB
9/20/2004 7:06:18 PM
asp.net.visual-basic.net 3721 articles. 0 followers. Follow

1 Replies
1297 Views

Similar Articles

[PageSpeed] 51

With Alex Lowe's translator


' Messages
Private NoFileMessage As String = "No file selected"
Private UploadSuccessMessage As String = "Uploaded Sucess"
Private NoImagesMessage As String = "No Images"
Private NoFolderSpecifiedMessage As String = "No folder"
Private NoFileToDeleteMessage As String = "No file to delete"
Private InvalidFileTypeMessage As String = "Invalid file type"
Private AcceptedFileTypes() As String = {"JPG", "GIF", "jpg", "jpeg", "jpe", "gif", "bmp", "png"}
' Configuration
Private UploadIsEnabled As Boolean = False
Private DeleteIsEnabled As Boolean = True
Private DefaultImageFolder As String = "images"

Private Sub Page_Load(sender As Object, e As System.EventArgs)
' string isframe = "" + Request["frame"];
' if (isframe != "") {
MainPage.Visible = True
'iframePanel.Visible = false;
Dim rif As String = "uploader/uploaded_files" '+ Request["rif"];
Dim cif As String = "uploader/uploaded_files" '+ Request["cif"];
If cif <> "" And rif <> "" Then
RootImagesFolder.Value = rif
CurrentImagesFolder.Value = cif
Else
RootImagesFolder.Value = DefaultImageFolder
CurrentImagesFolder.Value = DefaultImageFolder
End If

UploadPanel.Visible = UploadIsEnabled
DeleteImage.Visible = DeleteIsEnabled

Dim FileErrorMessage As String = ""
Dim ValidationString As String = ".*("
'[\.jpg]|[\.jpeg]|[\.jpe]|[\.gif]|[\.bmp]|[\.png])$"
Dim i As Integer
For i = 0 To AcceptedFileTypes.Length - 1
ValidationString += "[\." + AcceptedFileTypes(i) + "]"
If i < AcceptedFileTypes.Length - 1 Then
ValidationString += "|"
End If
FileErrorMessage += AcceptedFileTypes(i)
If i < AcceptedFileTypes.Length - 1 Then
FileErrorMessage += ", "
End If
Next i
FileValidator.ValidationExpression = ValidationString + ")$"
FileValidator.ErrorMessage = FileErrorMessage

If Not IsPostBack Then
DisplayImages()
End If
End Sub 'Page_Load
' } else {
' }
Public Sub UploadImage_OnClick(sender As Object, e As EventArgs)
If Page.IsValid Then
If CurrentImagesFolder.Value <> "" Then
If UploadFile.PostedFile.FileName.Trim() <> "" Then
If IsValidFileType(UploadFile.PostedFile.FileName) Then
Try
Dim UploadFileName As String = ""
Dim UploadFileDestination As String = ""
UploadFileName = UploadFile.PostedFile.FileName
UploadFileName = UploadFileName.Substring((UploadFileName.LastIndexOf("\") + 1))
UploadFileDestination = HttpContext.Current.Request.PhysicalApplicationPath
UploadFileDestination += CurrentImagesFolder.Value
UploadFileDestination += "\"
UploadFile.PostedFile.SaveAs((UploadFileDestination + UploadFileName))
ResultsMessage.Text = UploadSuccessMessage
Catch ex As Exception
'ResultsMessage.Text = "Your file could not be uploaded: " + ex.Message;
ResultsMessage.Text = "There was an error."
End Try
Else
ResultsMessage.Text = InvalidFileTypeMessage
End If
Else
ResultsMessage.Text = NoFileMessage
End If
Else
ResultsMessage.Text = NoFolderSpecifiedMessage
End If
Else
ResultsMessage.Text = InvalidFileTypeMessage
End If
DisplayImages()
End Sub 'UploadImage_OnClick

Public Sub DeleteImage_OnClick(sender As Object, e As EventArgs)
If FileToDelete.Value <> "" And FileToDelete.Value <> "undefined" Then
Try
Dim AppPath As String = HttpContext.Current.Request.PhysicalApplicationPath
System.IO.File.Delete((AppPath + CurrentImagesFolder.Value + "\" + FileToDelete.Value))
ResultsMessage.Text = "Deleted: " + FileToDelete.Value
Catch ex As Exception
ResultsMessage.Text = "There was an error."
End Try
Else
ResultsMessage.Text = NoFileToDeleteMessage
End If
DisplayImages()
End Sub 'DeleteImage_OnClick

Private Function IsValidFileType(FileName As String) As Boolean
Dim ext As String = FileName.Substring(FileName.LastIndexOf(".") + 1, FileName.Length - FileName.LastIndexOf(".") - 1)
Dim i As Integer
For i = 0 To AcceptedFileTypes.Length - 1
If ext = AcceptedFileTypes(i) Then
Return True
End If
Next i
Return False
End Function 'IsValidFileType

Private Function ReturnFilesArray() As String()
If CurrentImagesFolder.Value <> "" Then
Try
Dim AppPath As String = HttpContext.Current.Request.PhysicalApplicationPath
Dim ImageFolderPath As String = AppPath + CurrentImagesFolder.Value
Dim FilesArray As String() = System.IO.Directory.GetFiles(ImageFolderPath, "*")
Return FilesArray


Catch
End Try
Else
Return Nothing
End If
End Function 'ReturnFilesArray

Private Function ReturnDirectoriesArray() As String()
If CurrentImagesFolder.Value <> "" Then
Try
Dim AppPath As String = HttpContext.Current.Request.PhysicalApplicationPath
Dim CurrentFolderPath As String = AppPath + CurrentImagesFolder.Value
Dim DirectoriesArray As String() = System.IO.Directory.GetDirectories(CurrentFolderPath, "*")
Return DirectoriesArray
Catch
End Try
Else
Return Nothing
End If
End Function 'ReturnDirectoriesArray

Public Sub DisplayImages()
Dim FilesArray As String() = ReturnFilesArray()
Dim DirectoriesArray As String() = ReturnDirectoriesArray()
Dim AppPath As String = HttpContext.Current.Request.PhysicalApplicationPath
Dim AppUrl As String

'Get the application's URL
If Request.ApplicationPath = "/" Then
AppUrl = Request.ApplicationPath
Else
AppUrl = Request.ApplicationPath + "/"
End If
GalleryPanel.Controls.Clear()
If FilesArray Is Nothing Or FilesArray.Length = 0 And(DirectoriesArray Is Nothing Or DirectoriesArray.Length = 0) Then
gallerymessage.Text = NoImagesMessage '+ ": " + RootImagesFolder.Value;
Else
Dim ImageFileName As String = ""
Dim ImageFileLocation As String = ""

Dim thumbWidth As Integer = 94
Dim thumbHeight As Integer = 94

If CurrentImagesFolder.Value <> RootImagesFolder.Value Then

Dim myHtmlImage As New System.Web.UI.HtmlControls.HtmlImage()
myHtmlImage.Src = AppUrl + "images/ftb/folder.up.gif"
myHtmlImage.Attributes("unselectable") = "on"
myHtmlImage.Attributes("align") = "absmiddle"
myHtmlImage.Attributes("vspace") = "36"

Dim ParentFolder As String = CurrentImagesFolder.Value.Substring(0, CurrentImagesFolder.Value.LastIndexOf("\"))

Dim myImageHolder As New System.Web.UI.WebControls.Panel()
myImageHolder.CssClass = "imageholder"
myImageHolder.Attributes("unselectable") = "on"
myImageHolder.Attributes("onclick") = "divClick(this,'');"
myImageHolder.Attributes("ondblclick") = "gotoFolder('" + RootImagesFolder.Value + "','" + ParentFolder.Replace("\", "\\") + "');"
myImageHolder.Controls.Add(myHtmlImage)

Dim myMainHolder As New System.Web.UI.WebControls.Panel()
myMainHolder.CssClass = "imagespacer"
myMainHolder.Controls.Add(myImageHolder)

Dim myTitleHolder As New System.Web.UI.WebControls.Panel()
myTitleHolder.CssClass = "titleHolder"
myTitleHolder.Controls.Add(New LiteralControl("Up"))
myMainHolder.Controls.Add(myTitleHolder)

GalleryPanel.Controls.Add(myMainHolder)
End If

Dim _Directory As String
For Each _Directory In DirectoriesArray

Try
Dim DirectoryName As String = _Directory.ToString()


Dim myHtmlImage As New System.Web.UI.HtmlControls.HtmlImage()
myHtmlImage.Src = AppUrl + "images/ftb/folder.big.gif"
myHtmlImage.Attributes("unselectable") = "on"
myHtmlImage.Attributes("align") = "absmiddle"
myHtmlImage.Attributes("vspace") = "29"

Dim myImageHolder As New System.Web.UI.WebControls.Panel()
myImageHolder.CssClass = "imageholder"
myImageHolder.Attributes("unselectable") = "on"
myImageHolder.Attributes("onclick") = "divClick(this);"
myImageHolder.Attributes("ondblclick") = "gotoFolder('" + RootImagesFolder.Value + "','" + DirectoryName.Replace(AppPath, "").Replace("\", "\\") + "');"
myImageHolder.Controls.Add(myHtmlImage)

Dim myMainHolder As New System.Web.UI.WebControls.Panel()
myMainHolder.CssClass = "imagespacer"
myMainHolder.Controls.Add(myImageHolder)

Dim myTitleHolder As New System.Web.UI.WebControls.Panel()
myTitleHolder.CssClass = "titleHolder"
myTitleHolder.Controls.Add(New LiteralControl(DirectoryName.Replace(AppPath + CurrentImagesFolder.Value + "\", "")))
myMainHolder.Controls.Add(myTitleHolder)

GalleryPanel.Controls.Add(myMainHolder)
Catch
End Try ' nothing for error
Next _Directory

Dim ImageFile As String
For Each ImageFile In FilesArray

Try

ImageFileName = ImageFile.ToString()
ImageFileName = ImageFileName.Substring((ImageFileName.LastIndexOf("\") + 1))
ImageFileLocation = AppUrl
ImageFileLocation = ImageFileLocation.Substring((ImageFileLocation.LastIndexOf("\") + 1))
'galleryfilelocation += "/";
ImageFileLocation += CurrentImagesFolder.Value
ImageFileLocation += "/"
ImageFileLocation += ImageFileName
Dim myHtmlImage As New System.Web.UI.HtmlControls.HtmlImage()
myHtmlImage.Src = ImageFileLocation
Dim myImage As System.Drawing.Image = System.Drawing.Image.FromFile(ImageFile.ToString())
myHtmlImage.Attributes("unselectable") = "on"
'myHtmlImage.border=0;
' landscape image
If myImage.Width > myImage.Height Then
If myImage.Width > thumbWidth Then
myHtmlImage.Width = thumbWidth
myHtmlImage.Height = Convert.ToInt32((myImage.Height * thumbWidth / myImage.Width))
Else
myHtmlImage.Width = myImage.Width
myHtmlImage.Height = myImage.Height
End If
' portrait image
Else
If myImage.Height > thumbHeight Then
myHtmlImage.Height = thumbHeight
myHtmlImage.Width = Convert.ToInt32((myImage.Width * thumbHeight / myImage.Height))
Else
myHtmlImage.Width = myImage.Width
myHtmlImage.Height = myImage.Height
End If
End If

If myHtmlImage.Height < thumbHeight Then
myHtmlImage.Attributes("vspace") = Convert.ToInt32((thumbHeight / 2 - myHtmlImage.Height / 2)).ToString()
End If


Dim myImageHolder As New System.Web.UI.WebControls.Panel()
myImageHolder.CssClass = "imageholder"
myImageHolder.Attributes("onclick") = "divClick(this,'" + ImageFileName + "');"
myImageHolder.Attributes("ondblclick") = "returnImage('" + ImageFileLocation.Replace("\", "/") + "','" + myImage.Width.ToString() + "','" + myImage.Height.ToString() + "');"
myImageHolder.Controls.Add(myHtmlImage)


Dim myMainHolder As New System.Web.UI.WebControls.Panel()
myMainHolder.CssClass = "imagespacer"
myMainHolder.Controls.Add(myImageHolder)

Dim myTitleHolder As New System.Web.UI.WebControls.Panel()
myTitleHolder.CssClass = "titleHolder"
myTitleHolder.Controls.Add(New LiteralControl(ImageFileName + "<BR> <input type=checkbox name=" + ImageFileName + " value=checkbox> " + myImage.Width.ToString() + "x" + myImage.Height.ToString()))
myMainHolder.Controls.Add(myTitleHolder)

'GalleryPanel.Controls.Add(myImage);
GalleryPanel.Controls.Add(myMainHolder)

myImage.Dispose()
Catch
End Try
Next ImageFile
gallerymessage.Text = ""
End If
End Sub 'DisplayImages

Thanks,

Teemu Keiski
Finland, EU
0
joteke
9/21/2004 9:45:08 AM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

What are the diff. visual basic 6 and vb.net ? How to convert the VB6 project to vb.net proj ?
What are the diff. visual basic 6 and vb.net ? How to convert the VB6 project to vb.net proj ? with code and interface too. There are entire forums dedicated to the differences between the two, and to convert your projects you should try the upgrade wizard in Visual Studio....

Converting from vb.net to c#.net
Hello I have recently purchased VBGolds RawDataPrinter which should allow users to print directly to label printers on our network directly from a c# web form.  Unfortunately they only supply vb.net examples and I have need of c#.  The component has been installed on our web server.  This is some code that they have supplied as examples in vb.net   "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >"Head1" runat="server&qu...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

C#.NET or VB.NET
what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

Convert VB.Net application to C#.net
Haican any one help me to convert VB.Net application in this link to C#.net http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6718&lngWId=10RegardsAnu Palavila  Regards Anu Palavila Use this Free Conversion tool - http://www.developerfusion.com/tools/convert/vb-to-csharp/  ASP.NET Grid With Excel Capabilities | 27 GridView Tips & Tricks | Hosting your site? | SQL Server Tips Other Code Convertors (convert VB to C# and C# to VB) http://converter.telerik.com/ http://www.developerfusion.com/tools/convert/csharp-to-vb/ http://www.dotnetspider.com...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

Visual Studio .Net? Visual Basic .Net?
Okay, I admit it -- I know nothing about .Net. I'm a Visual Basic and ASP developer. DotNetNuke is my first tentative step into the whole ".Net Thing", and I'm looking for some advice... What do I really need to be able to make some modifications, or new modules for DotNetNuke? Do I need the full, THOUSAND DOLLAR Visual Studio .Net 2003 package, or can I get away with the HUNDRED DOLLAR Visual Basic .Net Standard package?Chameleon Systems, Inc. You can use webmatrix, available here for free. One of the drawbacks of webmatrix however is that it does not support code-be...

Visual Basic.NET or Visual Studio.NET?
OK, this has probably been asked before... I'm a student looking to cut my costs, and I can do this by just purchasing Visual Basic.NET as opposed to the fully-fledged Visual Studio.NET application. Of course, I'll only be able to program in VB, but that's fine with me. I wanted to know if all of the ASP.NET specific options are available, such as using a WYSIWYG editor? I'd also like to know if VB.NET has IntelliSense, or that's a specific option only available to Visual Studio.NET users. Thanks in advance. I'd have to believe that VB.Net has intellisense. What is the price d...

online sites to convert C#.Net to VB.Net
what are the best sites to convert C#.Net code to VB.Net code? I have to convert .net 2005 code from one to the other. just wondering what your experiences have been. thanks much I am a big fan of developer fusion's converters. I think they work reasonably well. They are quick and get the job done, and it is quick and easy to go either way. VB to C# or C# to VB.http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspxhttp://labs.developerfusion.co.uk/convert/csharp-to-vb.aspxJust my recommendation. I am sure you'll hear a few different responses.Brendan C. Brendan EnrickBr...

Web resources about - convert c#.net page to vb.net - asp.net.visual-basic.net

List of converts to Buddhism - Wikipedia, the free encyclopedia
Ajahn Brahm (born 1951), Religious teacher and student of the late Thai monk Ajahn Chah . Currently he is the abbot of the Bodhinyana Monastery, ...

Facebook Timeline For Pages: 8 Million Converts, 29 Million To Go
... reach to 98 percent of users who liked its page, as well as to double its engagement rate, during a 28-day period. Dr. Pepper hasn’t yet converted ...

Facebook stock roundup: Execs offload more stock, directors convert shares
... Bowles, the former co-chair of the now-defunct National Commission on Fiscal Responsibility and Reform, and Reed Hastings, Netflix CEO, converted ...

How to Convert Leads Into Buying Customers - The 9 Step Sales Process EVERYONE Should Use
... School of Business in Toronto on the topics of Sales and Entrepreneurship. I shared with them the sales process that I find How to Convert Leads ...

Bitcoin : Should I convert my savings to Bitcoin?
Answer (1 of 7): You should think of this question as "Should I invest all my savings in Bitcoin?", and not "Should I have my savings denominated ...

Coordinates - Calculate and Convert a Position on the App Store on iTunes
Get Coordinates - Calculate and Convert a Position on the App Store. See screenshots and ratings, and read customer reviews.

Catholics should not convert Jews, says Vatican, in push against anti-Semitism
... 50 years since the Vatican's repudiation of the concept of Jewish guilt for Jesus' death.  Vatican City: Catholics should not try to convert ...

Today’s apps gone free: BlockBear, Stock Grader, PDF Smart Convert and more
Block ads and other annoying content, take the emotion out of investing, and convert almost anything into a PDF with todays collection of apps ...

Ford patents rear wheel that converts into a unicycle
Filed under: Government/Legal , Green , Ford , Green Driving , Motorcycle , Electric Ford is thinking about allowing drivers to remove a rear ...

How to convert your old VHS tapes to DVD with this software
Remember those old VHS tapes you have sitting in the corner? Convert them into DVDs with this affordable software so you can easily watch them ...

Resources last updated: 1/11/2016 7:46:46 AM