Converting From C# To VB?
Dec 30, 2009I am trying to convert this code from C# to VB. Tried to use third party tools, but not successful.
[code]...
I am trying to convert this code from C# to VB. Tried to use third party tools, but not successful.
[code]...
my goal is to
1.Take an file(exe,dll,etc)
2.Convert it into hex
3.place that hex values in a stack
4.Execute the values inside the stack to its original form(i.e. take the elements out of stack and then convert it to a compile format)
Imports System.IO
Sub Main()
Dim fileName As String = "ABC.exe"
[code]....
I am having trouble converting this Do Until loop to a Do While loop. Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click calculates and displays the average sales amount Const strPROMPT As String = _
[Code]...
I have the following in vb.net and need to convert it to c#. Seemed rather simple at first but I need to pass in the NamedObject variable as welll which is supported in vb.net but not in c#..
What are my options.
Here is the vb.net - notice the NamedObject
Public Property Datos(ByVal NamedObject As String) As T
Get
Return CType(HttpContext.Current.Session.Item(NamedObject ), T)
[Code]....
I am trying to convert an MP3 to a wav. The wav file is created, but I am having problems elsewhere. The label is displaying the wrong data("Cancel/Error") and the progressbar is doing nothing. I am using lame 3.98 .exe and a wrapper for the exe. I downloaded the LameShell project from codeproject. Here is a section of the wrapper class. This was originally for resampling a mp3 to mp3.
[Code]...
I'm developing a program to execute powershell from .net app. I found a sample but it uses c# so I'm changing the code to vb.net but I don't know how change the following line:
Collection<psobject /> results = pipeline.Invoke();
The C# version works but when I convert it to VB it doesn't. What am I doing wrong?Its for opening an HTML doc into a usercontrol.
VB
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
[Code]...
how to convert this c++ sub to vb.net?
// Create points to simulate ellipse using beziers
void EllipseToBezier(CRect& r, CPoint* cCtlPt)
{
// MAGICAL CONSTANT to map ellipse to beziers
[code]....
I found some code on preventing DOS attacks written by Omar Al Zabir thta I would really like to use on a website written in VB.NET.
The code is at the following link -[URL] but is in C# I tried to convert using variios different programs but there seems to be one line that keeps giving me problems.It's the line
var hit = (HitInfo)(context.Cache[key] ?? new HitInfo());
in the method -
public static bool IsValid( ActionTypeEnum actionType )
{
HttpContext context = HttpContext.Current;
if( context.Request.Browser.Crawler ) return false;
[code].....
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code].....
I am converting my project from VB6 to VB.net 3.5 and at one place i have declared private variable a() as variant and i am using some place as b =a(index,0) it will work in VB but gives me error in VB.Net the error is Number of Indices exceeds the number of dimensions of the indexed array.
View 4 RepliesIt is a program on which logic programs can be developed, compiled and downloaded into Programmable Logic Controllers. It is fairly big and complicated and the resulting .exe file is about 2Mb. I need to develop the program further now, and would like to use VB.net. When I try loading the VB6 code into VB.net, it changes all the variables of type Integer and String into type Object. It then states all through the resulting code that the default values are not defined. I assume that if defined as Integer and String variables do not need a default value, it would assume them to be 0 and empty. Any ideas why the program changes the variable types during the converstion? All forms start with 'Option Explicit', so all variables are defined.
View 3 RepliesI am trying convert a macro for MSProject from VBA to VB to create an add-in. What I am struggling with is the code to set the values of fields on a windows form and how to actually display the form.
What I have so far is:
Dim objProj As Microsoft.Office.Interop.MSProject.Project
Dim objTasks As Microsoft.Office.Interop.MSProject.Tasks
Dim objTask As Microsoft.Office.Interop.MSProject.Task
[Code].....
the following is brief description of how my project works. GUI is used to collect information from User and validates.have got dll named control-class that pass input data from GUI to Business logic DLL.this dLL connect to the database and saves data.after that,it disconnected and takes the results to the control dll,then to GUI which interprets if the input data was successful or not.Is there a tool that can be used to convert VB6 GUI to .net web forms? am not familiar to vb.net.how do you create reference to vb6 dll or COM from vb.net?
View 2 RepliesI was following this thread [URL]to convert Hex to RGB, but Left$ and Right$ shows up as errors does anyone know why?
View 10 RepliesI have read the threads on converting PNG to ICO format. I came up with the code below. This works, but it creates a black background where the PNG had a transparent background.[code]....
The _File variable above is a string that has the path to the PNG file.
I was put in a situation where I had to convert RC4 code from c# into vb
I tried getting already made codes online but they did not seem to work as the currently c# one that I have. Maybe a professional will see the mistake I am making. Both codes give a different encrypted result.
c# code:
public static string RC4(string pStrMessage, string pStrKey)
{
char[] lBytAsciiAry;
int[] lBytKeyAry;
[Code].....
converting this to VB.net? Sorry if its wrong forum.
select
((dateadd(dd,0,
datediff(dd,0,GETDATE()))
-
cast((GETDATE()-.5)
[Code]...
I'm actually coding this in c# but I might be able to convert it from vb.net Group1 does not have a declared type, but I believe it should be String.I'm not sure what this part means. Group1 = Right(Space(5) & CLng("&H" & Group1), 5)What is the vb.net or c# equiv?
View 4 RepliesI'm converting a program from VB6 to VB.NET, but some parameters are declared as "Any". For example:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"(ByRef Destination As Any, ByRef Source As Any, ByVal length As Integer)
Private Declare Function NWDSGetContext Lib "netwin32" (ByVal context As Integer, ByVal key As Integer, ByRef Value As Any) As Integer
"As Any" is not supported in VB.NET so I'm wondering what I should change it to.
I'am trying to convert a vb6 form to vb net but i had this error Le concepteur ne peut pas traiter le code de la ligne 307: Me.ImageList1.Key_0 = "" Le code dans la méthode 'InitializeComponent' est généré par le concepteur et ne doit pas être modifié manuellement. Supprimez les modifications et essayez de rouvrir le concepteur.
View 1 RepliesI have this piece of code which is calling some functions in a web service. however the original was written in VB and when I have converted it it gives me an error in my c# stating that 'The name Information does not exist in the current context' I have checked the VB and it win there either!
[Code]...
I have a COM object in C++ and VB6 and everything is compiled and packaged using Visual Studio 2003. The C++ generates the DLL, and VB6 the EXE, so from the legacy code I can call the EXE that calls the DLL and so on. I need to migrate these to Visual Studio 2008. However, I have some questions
1) I can compile the C++ and generate the DLL - ( I think is ok)2) VB.Net doesn't have the option to generate COM/ActviveX anymore as VB6, so no idea - I tried to generate windows exe and call the dll, but it doesn't work. I think because it has some COM calls.
So what is the best solution to get rid of COM/ActiveX and deliver something?
Compile in C++ and load adding references in VB.net? I tried this but the DLL doesn't load..
I'm in the process of teaching myself C# by converting an existing project and am stuck converting the following vb linq code:
Dim outStuff = From tt In (From t In Products.SelectMany(Function(p) If(p.tags IsNot Nothing, p.tags, New ObservableCollection(Of TagModel)))
Group By tagName = t.name,
v = (Aggregate p In Products Where If(p.tags IsNot Nothing, p.tags.Contains(t), Nothing) Into Sum(p.views)),
nl = (Aggregate p In Products Where If(p.tags IsNot Nothing, p.tags.Contains(t), Nothing) Into Sum(p.num_likes))
[Code]...
var x = Products.SelectMany(p => (p.tags != null) ? p.tags : new ObservableCollection<TagModel>());
var tags = from t in x group t by t.name into g select new { tagname=g.First().name};
I converted our project from .NET 2.0 to 3.5 and am looking for optimizations that can be done utilizing 3.5 framework. What are some of the things I can do with 3.5 as in Datastructures. using DataAccess apart from LINQ to SQL.
View 5 RepliesI'm following the ASP.NET MVC Tutorial and having started in VB.NET I'm having trouble converting the following razor code:
[code]...
on both the <li> tags. I understand I need to use line continuation but can't figure out where. I'd be greatful if you can point out the problem.
I have an asp.net page WineCompDefault.aspx which was initially implemented with VB code behind. I am now trying to change the code behind to CS. I modified the page directive in the aspx page as follows:
From -
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="WineCompDefault.aspx.vb" Inherits="WineCompDefault" %>
[Code]....
The problem is it says "The type or namespace Public could not be found". I do not know what is wrong or missing.
(Also, note, I will remove the VB file once I am sure the CS is working correctly. That is why I would like to keep both in the project at this time)
I got this code from msdn[URL]..I have most of it converted but having an issue with the following sub getting it converted correctly Protected Overrides Sub AdjustEventHandlers(ByVal sender As
[Code]...
I am converting some C# code to VB, the following code is part of a function
if (bool.Parse(v["Parent"].ToString()))
{
e.Row.CssClass = "Parent";
[Code]....
The code throws an error "String was not recognized as a valid Boolean" But if I use this code
If CBool(v("Parent").ToString) = True Then
e.Row.CssClass = "Parent"
End If
It works fine, which is great
I made a program a couple of months ago and decided to put it up for sale for a minimal about of basicly just to cover costs. Seems word got round and people from all sorts of places are asking if I can modify program and add features which I have done and was happy to do. I have around 57 requests in my E-Mail at the moment asking me to make a Mac version and from what I can tell, all the proccess involves is converting the .exe file to a file which can be run on the mac. Before someone offering there good faith to test it for me. I'm sorry but that won't be an option for me.Would like to run a Virtual Machine, but that would be against copy right laws. Is there any other way to test it except buying a Mac?
View 2 Replies