[Solved] Assign line numbers to items in text

The question may be a case of “I have X and I need Y” where X is the item which needs attention. If the string really is as you presented it, then Imports System.Text Module Module1 Sub Main() Dim s = “{ “”0″”:{“”variable1″”:””ABC1″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”5″”:{“”variable1″”:””ABC2″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”3″”:{“”variable1″”:””BC3″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”1″”:{“”variable1″”:””DC4″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”4″”:{“”variable1″”:””DD5″”,””variable2″”:””AA””,””variable3″”:””BB””} }” Dim t = s.Split({vbCrLf}, StringSplitOptions.None) Dim u … Read more

[Solved] Calculating elapsed time [closed]

You may use the System.Diagnostics.Stopwatch class to time operations precisely in .NET. Dim stopwatch As New Stopwatch() stopwatch.Start() ‘Perform timed operations here stopwatch.Stop() The elapsed TimeSpan may now be retrieved as stopwatch.Elapsed. For a direct analogue to your C code, you would write: Dim elapsed = stopwatch.Elapsed.TotalSeconds 2 solved Calculating elapsed time [closed]

[Solved] Display byte array in textbox [closed]

The equivalent C# of your last line is: TextBox1.Text = String.Join(“”, Array.ConvertAll(bArr, byteValue => byteValue.ToString())); You replace the anonymous function with a lambda expression (byteValue => byteValue.ToString()) As I noted in my comment, this will print the decimal values of the bytes, so 0x00 will be printed as 1, and 0xFF will be printed as … Read more

[Solved] File.Exists is working in C#, but doesn’t work in VB.NET

Try this way: Dim stringData As String = GetFolderPath(SpecialFolder.MyDocuments) & “\my.exe” ‘For example If Not String.IsNullOrEmpty(stringData) Then If File.Exists(stringData) Then Process.Start(stringData) Else MsgBox(“File couldn’t be found.”, vbCritical, “MyApp”) End If End If solved File.Exists is working in C#, but doesn’t work in VB.NET

[Solved] I need to convert VB.net Code to C# [closed]

You can use this link to convert from C# to VB.Net and vice-versa public List<Course> GetCourses(int StudentID) { MyLearningEntities xEntity = new MyLearningEntities(); List<Course> xList = new List<Course>(); Student xStudent = default(Student); xStudent = (from x in xEntity.Students.Include(“Courses”) where x.StudentID == StudentID select x).FirstOrDefault(); if (xStudent != null) return xStudent.Courses.ToList; else return xList; } 0 … Read more

[Solved] VB Code For Showing Battery Status [closed]

If you are looking for VB6 code(which I guessed) Then I found the code here:- Private Sub Form_Load() MsgBox “Battery status: ” & getBatteryStatus(), vbInformation + vbOKOnly, “Battery Status” End End Sub Public Function getBatteryStatus() As Integer Dim obj As Object, obj2 As Object, stat As Integer ‘ Get Battery Status ‘ Return Value Meaning … Read more

[Solved] How do I convert ‘Single’ to binary?

The example expected value you’ve provided is just a straight binary representation of the number, however while probably not the most efficient way if you wanted to get the IEEE-754 representation of the number in binary you could use BitConverter.GetBytes as in the following example: Sub Main Dim i As Int32 = 1361294667 Console.WriteLine(ObjectAsBinary(i)) Dim … Read more

[Solved] vb.NET If Then Replacement

Try a ternary operator. Me.Backcolor = If(rdoRed.Checked, rdoRed.Forecolor, [some other color]) Like this example: Is there a conditional ternary operator in VB.NET? 4 solved vb.NET If Then Replacement

[Solved] Drawing Textbox at runtime in VB.net and indexing

You can try a resizable UserControl. Create a new UserControl as a template (German, but you will find it): Set the BorderStyle to FixedSingle. Add a Label to the UserControl. I called it lblInner: Now for some coding including the possibility to resize the UserControl at Runtime using Mouse Handles. Please note that the code … Read more

[Solved] How to delete a folder? In VB.Net

You can’t. My answer had nothing to do with using databases. Which is why I apologised for misreading your original question. I should delete it and let someone else answer. 1 solved How to delete a folder? In VB.Net