Conversion From CSharp Of Some Code
May 31, 2011What the vb.net code should be of below c sharp code? [code]
View 1 RepliesWhat the vb.net code should be of below c sharp code? [code]
View 1 RepliesI have some code that was written in C# and am attempting to convert it to VB.Net, for the most part things have gone well but I am running into an issue that I am not sure how to handle. The project has several classes and a few namespaces defined. The issue is [or seems to be] related to the namespace usage.
In the C# code of one class I have
Code:
namespace GdiPlusLib
In another class I have
Code:
using GdiPlusLib;
When translated to VB I have in the first class above
Code:
Namespace GdiPlusLib
and the following in the other class from above.
Code:
Imports GdiPlusLib
I get the following warning message on the imports line
Namespace or type specified in the Imports 'GdiPlusLib' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. There is another instance with a different namespace that gives the same warning and I get 11 errors all of which would seem to be related to the two warnings.
VB.NETbyte[] packetTemp;
packetTemp[1] = (byte)pSize1;
return new byte[0];
CSharp (converted but i don't think they are correct):Dim packetTemp As Byte();
Return New Byte() {0}
what's the vb.Net counterpart of the following blocks in Csharp?
[Code]...
I have been trying to design a custom tabcontrol in vb.net used a codeproject example to develop the said tabcontrol but the example is in C# I have converted all parts and theres only one error i cant seem to work around
[Code]...
if this is the wrong section since my result code will ve in vb thats why i posted it here.
what's the vb.Net counterpart of the following blocks in Csharp?
public class NullableDateTimePicker : System.Windows.Forms.DateTimePicker
{
Default Constructor
public NullableDateTimePicker() : base()
{
[code].....
i want to know how I could run a Csharp form from a VB project by pressing on a button.
View 6 RepliesI am converting a C# Web Application to VB.NET. The problem occurs with the line "Array.Sort". I am unable to find a VB.NET equivalent of this line.
ArrayList arrSymbologies = new ArrayList();
get all public static properties
PropertyInfo[] propertyInfos;
propertyInfos = typeof(BarCodeReadType).GetProperties(BindingFlags .Public |
BindingFlags.Static);
[code]....
I tried different online (free) C# to VB.NET converters, they convert is as follows, but the Visual studio 2008 give errors (BC30201: Expression expected. ; BC32017: Comma, ')', or a valid expression continuation expected.)
Array.Sort(propertyInfos, Function(propertyInfo1 As PropertyInfo, propertyInfo2 As PropertyInfo) propertyInfo1.Name.CompareTo(propertyInfo2.Name))
convert this code into vb.net im using a device w/c is digital persona fingerprint scanner, the code works but it does not show any scanned image of the fingers in vb.net
[Code]...
PHP
<?php
$var1 = $_POST['userAge'];
[code].....
I want to convert this vb into c#, I cant correct it
Public Function encryptPassword(ByVal Password As String, ByVal Salt As String) As String
Using HashTool As New SHA512Managed()
Dim PasswordAsByte() As Byte = System.Text.Encoding.UTF8.GetBytes(String.Concat
[CODE]...
I was suggested this code:
public string encryptPassword(string Password, string Salt) {
Using;
((void)(HashTool));
[CODE]...
But it wasn't correct at all.
CODE:
Explain what the lines of code above are doing? i'm more interested in the first line as the method it is written in exits when it hits that line, so apparently the variable oXML isn't being set. i know that oXML is supposed to be set to some kind of COM object but can you explain the "Msxml2.DOMDocument.4.0" part a bit more? what is that, where is that, and what will it look like in .NET (this code is a classic asp)? i don't know what the second line of code above is either but the method never even reaches it so if you have any ideas about what that is doing would be great too.
I am starting on the NHibernate world and i am experimenting with the NHibernate CookBook
recipes, i am trying to set a base entity class for my entities and this is the C# code for this. I would like to know whats the VB.NET version so i can implement it in my sample project
Can anyone convert these C# code to VB.NET
NetworkChange.NetworkAddressChanged +=
new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
[code].....
I have the following macro that copies a set of rows and using the "Insert Copied Cell", replicates those rows.
[Code]...
I have a VBnet program that works fine and I'm hellbent on getting it to run under Linux eventually (looks like mono is the way to go sometime soon). But, for now, I'm looking at some of these code converters, online and otherwise and have some questions.
I tried a single procedure of code with the online converter and it threw quite a few errors relating to the procedure lines themselves (the opening Private sub etc, etc,)Something about C# and handles clauses -- can't remember.
So, I suppose the online converter just wants to see the code itself? As in, what lies between the Private sub blah -- CODE -- end sub?Now, what about something I saw this morning, "Sharpdevelop" that says it can convert entire PROJECTS to C#? (Also saw a 200.00 software package as well).
Is that the way to go? Will it do every bit of the project's code start to finish? You just load the project folder or the project file I guess?But then I see Sharpdevelop doesn't compile -- so you convert with it and then open the converted file with Visual studio C#.net?
I guess Microsoft will never have this conversion capability in visual studio?
I have downloaded a quick day view calendar control for my app. While it meets my needs I am having trouble converting the C# code to create a new appointment. Is anyone here good at code conversion?
The control is here:(url)
I have downloaded a quick day view calendar control for my app. While it meets my needs I am having trouble converting the C# code to create a new appointment. Is anyone here good at code conversion?
View 1 RepliesIs there any code conversion tool for converting Delphi to Visual Basic?
View 3 Repliesits an C# Code
GridView1.RowDataBound += new GridViewRowEventHandler(RowDataBoundHandler);
[code].....
I'm trying to implement sql dependency in my vb.net application as per: [url]. I'm having problems with the invoking code, when a notification is received the application locks up with no errors. (When MyOnChanged is called via the delegate). Have I made a mistake in my C# > VB.net conversion? [Code]
View 2 RepliesI have tried numuerous code conversion tools, and all have failed...I found an interesting snipper of code in C# that I have converted to VB, all but the following line of code. Cound someone please help to convert this C# to VB?
C#:
double totalRows = (int)myCommand.Parameters["@totalRows"].Value;
I am converting a VB6 program to VB express and am having a couple of problems. One of them is a problem with the variable "strEncTemp". I have the warning "Variable strEncTemp is used before it has been assigned a value", and I can't assign a value to this variable without creating issues. It also seems that a null value is being returned and the code produced by this routine is corrupt. This seems to be the last issue I have in converting the code. I tried setting it to 0 but it then shuts down the program with an error. This is the portion of code that has the warning and produces a null value. [Code]
View 4 RepliesI am writing a library in VB.NET in which I have added, among others, a class originally written in C# but converted into VB.NET. I don't know much about C# so therefore I have used online C# to VB.NET-converters. Now I am stuck with some code which I believe the online-converter was not able to "translate" properly.
When running the code I get the following error:
System.IndexOutOfRangeException was unhandled
Message="IndexOutOfRangeException"
StackTrace:
at System.String.get_Chars()
[Code]...
I am creating a bulk media converter. In order to do this I need to go through each line in a list box one after the other and run the conversion function. I am trying to use the following:
For Each item In listVideos.Items
conversion code
Next
However this makes the program want to convert all videos at the same time... is there anyway to get the program to convert one video and then after the conversion code is completed to move to the next one?Should also be noted that I am using FFMPEG for this project.
I am wondering if VB.NET has the "|=" Operator that is present in CSharp or if it goes by another name.
View 8 Repliesa user will enter a number, n, which ranges from 1 to 30. they will also enter a "P" or an "S" (sum or product). depending on which was selected, it will calculate the sum or product of the numbers from 1 to n.i'm having a conversion error on line 5 stating "Conversion from string "S" to type 'Double' is not valid." [code]
View 2 RepliesI'm creating a program in VB.net that does the following:At a high level I receive a file in email, put the attachment in a monitored folder, import the text file to excel, format the excel, and then email the excel file to a list of recipients.
Here is my plan:
Completed: Outlook VBA to monitor all incoming email for specific message. Once message is received drop attached .txt file in a specific network folder.
Completed: (VB.net) Monitor folder, when text file is added begin processing
Not Complete: (VB.net) Import text file to Excel
Not Complete: (VB.net) Format Excel Text file.(add in a row of data,format column headers with color/size, add some blank columns, add data validation to some of the blank columns that allow drop down selections)
Completed: (VB.net) Save file.
Completed: (VB.net) Send file to list of recipients.
Obviously the items above that are not complete are the bulk of the work, but I wanted to get some advice on what some of you think would be the best way to approach something like this. The import and formatting of the file are causing me some problems because I just can't decide what would be the most efficient way to do this.
The way stated above. Import to excel -> format Having a template excel that contains all of the formatting already done for me and attempting to transition the data to this document (no clue if/how I can do this). Is it even feasible? Have the template already created and then import the text file to a new excel file, then transition that data to the excel template?
Something I thought about, in terms of formatting the document, was to record a macro of me doing all of the formatting that I'm going to need and then attempt to convert that macro into my vb.net code, but I'm not sure if that will work. I will need to verify that the text file comes in the EXACT format every time correct?
Here's 2 questions that I hope someone can help me on. This is in VB.net. I keep on getting this error 'java.io.bufferedInputstream.count is not accessible in this context because it is 'Protected Friend'. Does anyone know how to fix this error?
The other errors i get are "Overload resolution failed because no accessible 'Val' accepts this number of arguments". I have listed below the code that I have coverted from Java. Where is my mistake?'the underlined areas are where it is giving me errors.
[Code]...i
I have some code to execute code at runtime...
Here is the main
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox1.Text.Trim <> "" Then
If TextBox2.Text.Trim <> "" Then
[code]....
When the button is pressed, it all works and the following files are created: yahoo.dll and yahoo.pdb My question is this: What is the code to load the already compiled yahoo files to execute the code again, without having to recompile the code?