Questions tagged [vb.net-to-c#]

Conversion of code written in Visual Basic .NET (VB.NET) to C#

Filter by
Sorted by
Tagged with
0 votes
1 answer
137 views

What is the equivalent DateAndTime.DateAdd in C#

I have an old code written in VB.Net and I am trying to convert it into c#. I am stuck on DateAndTime.DateAdd conversion for c# DateAdd(DateInterval.Month, -1, Now).ToString("MMM") This is ...
rabner casandra's user avatar
0 votes
0 answers
212 views

Migrating from ASP.NET 4.0 to DOT NET CORE

We have a big ASP.NET application with VB.Net Framework 4.0. We want to migrate to .NET 6 Is it better to first migrate to 4.8 then to .NET or directly from .NET Framework 4.0 to .NET 6.0 ? Is it ...
Kemal AL GAZZAH's user avatar
0 votes
1 answer
150 views

Convert VB Linq with Group by and Select to C# [duplicate]

I am trying to convert the following LINQ code from VB.NET to C#, which is performed on the DataTable "tvp_dtl". Followed by VB code. Dim query query = From row In tvp_dtl Group row ...
Alfredlau's user avatar
0 votes
0 answers
31 views

DropDownList cacadierend

Unfortunately I do not understand that. Have already tried a lot without success. Any help welcome! Compilerfehlermeldung: BC30456: 'idRegion_SelectedIndexChanged' is not a member of 'vb_aspx'. <...
Lothar Rappsilber's user avatar
1 vote
1 answer
410 views

Running a VB.NET webservice in .NET Core

I'm wondering what the best way to "Modernize" a VB.NET webservice is. I have a traditional webservice written using the System.Web.Services.WebService class in a old school website project. ...
user1854458's user avatar
1 vote
1 answer
473 views

how to avoid late binding in vb.net

I have a project written in vb.net .net version is 3.5 and its worked fine with no problems, now i decided to convert it into c#. I have using more than on tool, like instantc#, vbconversion, also the ...
Essam_Omiran's user avatar
0 votes
0 answers
25 views

How do I instantiate and consume a DLL library in C#

I have a DLL library that contains data and string functions, among other things. I've used it in VB.NET applications like this: Private Shared _ll As LLUtils.LLUtils _ll = New LLUtils.LLUtils("...
Lisa's user avatar
  • 157
-1 votes
2 answers
323 views

Cannot implicitly convert type 'string' to 'System.DateTime' - with t

As shown below, the error originates from what I believe is an error between translation over from Visual Basic to C#. I don't know whether this is an incorrect/outdated linked with VB, or what '...
user avatar
1 vote
1 answer
411 views

Option Strict causing compiling error within LINQ statement (implicit conversion 'Object' to 'Control')

We're currently converting a VB project to C#, and starting by enabling Option Strict. When enabled, the following line generates an error: Dim visiblePanelCount As Integer = (From c As Control In ...
EvilDr's user avatar
  • 8,981
1 vote
1 answer
389 views

Converting SQL command from vb .net to C#

I am trying to analyze SQL command text in vb.net and integrate it to be compatible with C#. I am having issues converting SQL command text from vb.net to c#. I used Telerik: http://converter....
Michele's user avatar
  • 57
0 votes
1 answer
382 views

showing two line grid on picture box

I am trying to make two reference line which shows the exact center position of the picture box in Visual Basic.net 2019. could you please help with it. I am attaching sample image How it seems like. ...
Ramesh Vantaku's user avatar
0 votes
0 answers
150 views

Converting VB to C# - error "invalid SimpleNonInvocationExpression"?

I am using SharpDevelop 4.4 to convert some VB.NET to C# code. It produced the following error which I don't understand: D:\path\ClassName.vb is not converted: Parser found 1 error(s) -- line 143 col ...
StayOnTarget's user avatar
  • 11.8k
-1 votes
1 answer
101 views

Error occurs in using If statement in my TableAdapter

I'm currently working with VB.NET on my previous projects. Now, switching to C# from VB.NET. I tried an online converter but it doesn't seem work. I get the following error: Cannot implicitly ...
Joa.know's user avatar
1 vote
1 answer
418 views

Get required columns from Access database

Currently, I am getting the tables and columns with help of GetOleDbSchemaTable. I also want to get that the given columns are required or not. string[] rest = new string[] { null, null, tableName, ...
Shyam's user avatar
  • 547
1 vote
3 answers
268 views

VB.Net to C# Conversion <sql></sql> [duplicate]

This is working in VB.Net Dim sSQL As String sSQL = <sql>MySQLQueryHere</sql>.Value But, this is not working in C# string sSQL = ""; sSQL = <sql>MySQLQueryHere</sql>.Value; ...
Sixthsense's user avatar
  • 1,927
0 votes
0 answers
278 views

Making a Shift Key for a keyboard on a Windows Form

I've recently started to learn both VB.net and C#. Anyway, I made a Windows Form application in VB.net that has a keyboard. To change the keys between upper and lower case, there is also a Shift ...
AndrewE's user avatar
-2 votes
2 answers
377 views

How to convert PInvoke `<[In](),Out()> ByRef` to C#?

I have a function from this VB.net that needs to be imported to C#. I have tried various VB.NET to C# converters but it does not work correctly with the imported dll associated with this function. ...
Thomas Koh's user avatar
0 votes
1 answer
928 views

what is the equivalent of UBound and Split(vb.net) in c#?

i have codes like this in vb.net If UBound(aTicketEntry) < 17 and aTicketEntry = Split(sBarcodeValidation, "|") and i try to code them like this but i got error on both them aTicketEntry = ...
Reden Rodriguez's user avatar
-1 votes
3 answers
119 views

how can i Translate this vb.net code to c# code?

how can i Translate this vb.net code to c# code? Public Function SetPiece(ByVal strGlobal As String, ByVal strNodes As String, ByVal strCode As String, ByVal intPiece As Integer, ByVal strNewVal As ...
Reden Rodriguez's user avatar
0 votes
1 answer
314 views

what is the equivalent of as Object,.Factory, byVal in vb.net to c#?

What is the equivalent of as Object, .Factory, ByVal in VB.NET to c#? Here's the code Dim mobjCNLib As Object Dim mCache As CacheObject.Factory Public Function GetPiece(ByVal strGlobal As String, ...
Reden Rodriguez's user avatar
2 votes
3 answers
5k views

ControlChars class in C#

Does anyone know what is equivalent to ControlChars.NullChar class in C#?
Chirag Solanki's user avatar
-1 votes
1 answer
694 views

FormView FindControl EditTemplate in C#

I have this in the Code Behind of a C# asp.net webforms that will not execute, transposed from a VB.NET File. The VB Webform executes it fine, finding the controls in edit mode from Pre-Render. ...
Ajay's user avatar
  • 5
2 votes
2 answers
90 views

vb.net code USING and WITH what is the code for c# [closed]

So im trying to learn c# because i want to change my old programming skill which is vb.net im opening some converter site but it doesn't work. I just want to know the code of USING and WITH in vb.net ...
Ndrangheta's user avatar
0 votes
1 answer
2k views

Why am I getting Cannot Convert from Method Group to Type error with this code?

I am trying to migrate some legacy VB.Net code to c#. I am using the Telerik Code Converter. Here is my legacy VB.Net Code Public Shared Function GetEnumIntFromString(ByVal value As String, ByVal ...
EiEiGuy's user avatar
  • 1,457
0 votes
1 answer
86 views

VB to C# "valuechanged" syntax [duplicate]

I am trying to learn C# and am rewriting a small calculator from vb to c#. I have been used to the following with vb: Private Sub nudGKCxCordDiamMM_ValueChanged(sender As Object, e As EventArgs) ...
RJ45's user avatar
  • 1
0 votes
2 answers
55 views

VB.NET to C# Linq

I have the following LINQ Dim z = (From d In db.GPSdevice Where d.CompanyId = currentuser.CompanyId And d.Type = "Truck" Or d.Type = "Trailer" ...
Oleg Sh's user avatar
  • 8,504
0 votes
1 answer
441 views

How to bind data in Excel Sheet in C#?

The code below is to bind a dataset to an Excel file in Vb.net One core record also binds in a .csv file I need this code to be translated to C# Public Function Write2CSV(ByVal ExlDs As Data....
Manohar A's user avatar
0 votes
0 answers
120 views

failed to run Microsoft face api in C#

I am trying to implement Microsoft Face API in C# using code available on GitHub. I followed all the steps given in : Microsoft Face API: Windows Client Library & Sample I have some errors ...
Hur's user avatar
  • 1
0 votes
0 answers
94 views

DotNetNuke > CreateUser Programatically Throws Error System.Typeinitializationexception

This one has eaten up my time today. I'm upgrading a web app that was originally built off an old version of DotNetNuke. The legacy app creates a user in DNN which I would think would be pretty ...
Vandelay Web's user avatar
-1 votes
1 answer
74 views

C# equivalent of for statement [duplicate]

The following statement is vb.net and I need the C# equivalent For i As Integer = 0 To Me.ListBox2.Items.Count - 1 Id = Me.ListBox2.Items(i).ToString I have tried numerous things but no luck....
shaggs's user avatar
  • 610
1 vote
0 answers
32 views

Is it necessary to check for subscribed events when wiring up event handlers?

I'm converting some custom server controls from VB to C#. In one control, this event exists: Private Sub MyControl_Init(sender As Object, e As System.EventArgs) Handles Me.Init ' ... End Sub ...
EvilDr's user avatar
  • 8,981
0 votes
2 answers
179 views

VB to C# - auto naming of event handlers vs explicit wiring

Sorry if this is a duplicate; I have searched extensively for a basic explanation. TL;DR - I already know how to wire up events, my question relates to supporting information and event handler ...
EvilDr's user avatar
  • 8,981
-4 votes
1 answer
113 views

Showing numbers 1 to 70 in VB.Net 2010

I would like to ask if who knows how to show numbers 1 up tp 70 in a label every time I click the button? To be specific, when I hit my Button "Next", automatically number 1 will show on my blank ...
a.baldivia's user avatar
0 votes
0 answers
359 views

Query of DateTime field with LINQ is throwing an exception in C# but not in VB.Net

My solution contains VB.NET and C# Projects. I`m querying the same DataTable (only the DataTable parameter name is different in both functions below) with LINQ. The same query gets the desired result ...
Jonathan Applebaum's user avatar
3 votes
1 answer
1k views

VB.NET to C# with Event Handlers

Hi all sorry but you must get this all the time, I have tried to search for it but could not find anything specific to what I am looking for. Basically I pretty much know VB.NET fully and I use it ...
altaaf.hussein's user avatar
0 votes
1 answer
196 views

Fingerprints matching and identification

I am developing a Windows application using VB.NET for a fingerprint identification system to match with the same individual fingerprints stored in my database SQL server. I heard of hardware to ...
Judaz Ojazy's user avatar
-1 votes
1 answer
73 views

What this mean in vb Do '' Bgw1 = Backgroundworker1 ? And how to convert it to csharp?

In my form1 designer i have only one backgroundworker name: Bgw1 but i don't have backgroundworker1 not in the designer and not in the code. Do '' Bgw1 = Backgroundworker1 If Bgw1....
Sharon Gabriel's user avatar
3 votes
1 answer
991 views

What is the reason for this code conversion failure?

I'm using the telerik code converter to try to convert this VB code to C#: ''' <summary> ''' Return the name of a property, field, or local variable from a lambda expression. ''' </summary&...
rory.ap's user avatar
  • 34.1k
19 votes
2 answers
3k views

Combine a character constant and a string literal to create another constant

I code in C# primarily these days, but I coded for years in VB.NET. In VB, I could combine a character constant and a string literal to create other constants, which is very handy: Const ...
rory.ap's user avatar
  • 34.1k
5 votes
4 answers
412 views

IEnumerator IEnumerable vb to C#

Hello everyone i'm new to c# language i was use vb.net, in below what is the error with this code and why, thank you vb.net code Class SplitString Implements IEnumerable Implements IEnumerator ...
Nour Ahmed's user avatar
-2 votes
1 answer
98 views

Converting SQL Server class vb to c# [closed]

How can I convert this code line Public Sub New() /*'StoredProcedure USE*/ MyBase.New(ConnectionStrings("MSSQL_DBConnectionString").ToString, "") Me.SelectCommandType = ...
ekrem tapan's user avatar
2 votes
1 answer
147 views

p.Start in C# errors

I've recently started to port a project to C# from VB, so I apologize if this is a noob-ish question. I can't seem to get this process to work for the life of me: Process p = default(Process); try { ...
gman5500's user avatar
0 votes
1 answer
5k views

how to write console output to a text file in vb.net

I'm currently faced some problem which is cannot convert/transfer the console output the a specific text file. I'm also tried use the below code. The problem is, it only can write first line from the ...
cg thanes's user avatar
2 votes
3 answers
464 views

How to translate this VB.NET code to C#?

I'm trying to translate this VB.NET code to C#, but I'm new with C#. This is my code VB.NET code: Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" ( _ ByVal hwnd As Integer, ...
grijalvaromero's user avatar
-5 votes
2 answers
7k views

Declare a VB.net method which will return list of integers [duplicate]

I got an assignment to change some things on vb.net project. Since I'm working with C# most of the time, I'm having some issues with some things. What I want to know is how can I create a method ...
Laziale's user avatar
  • 7,957
11 votes
3 answers
16k views

Why cannot convert null to type parameter T in c#?

I'm converting a bunch of code from VB to C# and I'm running in to an issue with a method. This VB method works great: Public Function FindItem(ByVal p_propertyName As String, ByVal p_value As ...
Robert Beaubien's user avatar
1 vote
2 answers
2k views

How to use SqlDataReader to get a value from a select without knowing its position on Visual Studio

I've translating a few things from VB to C# but there is something I haven't figured out how to do... This is the entire function Function get_projects_by_user(Optional uid As String = "", Optional ...
Vítor Martins's user avatar
-3 votes
4 answers
3k views

automatic capital letter at the beginning of a word when typing in textbox

I would like to create a function when typing in textbox the beginning of each sentence automatically becomes large. I've been unsuccessfully trying to make with VB.Net, but when I tried with C # ...
alfin p. efendy's user avatar
1 vote
1 answer
157 views

VB number representation is strange, how do i convert it to a natural number

So this may be obvious but i have recently inherited some legacy code and scattered around the code are array indexes like this someArray(&H7D0) I get that this "&H7D0" is the index but how ...
BastanteCaro's user avatar
  • 1,269
2 votes
4 answers
7k views

How do I use FileOpen (VB.NET) in C#?

So, I'm working on converting this code from VB.NET to C#: Public Class Form1 Const filesplit As String = "|split|" Dim stub, opt() As String Private Sub Form1_Load(sender As Object, ...
QaSe21's user avatar
  • 23