[Solved] How to resolve InvalidCastException after translating LINQ-to-JSON query from c# to VB.NET?

In order for {columns}.Concat(rows) to work, it seems you need to add an explicit call to AsEnumerable() in order to make sure the type TSource for Enumerable.Concat(IEnumerable<TSource>, IEnumerable<TSource>) is inferred correctly: Dim csvRows = { columns.AsEnumerable() }.Concat(rows) _ .Select(Function(r) String.Join(“,”, r)) Fixed fiddle #1 here. A DirectCast({columns}, IEnumerable(Of IEnumerable(Of String))) also seems to work, as … Read more

[Solved] How to merge two multiline textboxes

There are probably many ways you could do this. I have shown you one below but you would be assuming that textbox two contains the same amount of lines as textbox 1. It doesnt contain any validation but would do what you are asking. See the comments to understand what is happening. ‘Declare empty string … Read more

[Solved] Label Array in VB.net [closed]

If you have the timer set up and working already, try something like this for your array: ‘These will be your labels: Dim oLabel As New Label Dim oLabel2 As New Label ‘Create the array from your labels: Dim aLabels() As Label = {oLabel, oLabel2} ‘loop through your array: For each oLabel as Label in … Read more

[Solved] Trouble writing a select query [closed]

It looks like vb code if you want c# code then use following code cmd = new SqlCommand(“select name from wq where id='” + TextBox1.Text + “‘”, con); con.Open(); dr = cmd.ExecuteReader(); dr.Read(); TextBox2.Text = dr[0].ToString(); dr.Close(); con.Close(); 7 solved Trouble writing a select query [closed]

[Solved] Why does this multiplication cause an OverflowException?

I’m guessing that tsidx and StreamDataBlockSize are Integer types. The largest number an Integer type can hold is 2,147,483,647. The multiplication in brackets is then done expecting an integer result, but the answer is out of the range of Integer types. Change your code to .. Dim position As Long = hisFileHeader.StreamStartDataPosition + (CLng(TSIdx) * … Read more

[Solved] How do I embed a batch file in a vb program? [closed]

1) It’s probably silly to have a separate .bat file if you can do everything you want directly in the VB program. Have you considered just incorporating the functionality directly in VB? 2) To run a separate .bat file from VB.Net, perhaps the easiest way is to use Process.start(). EXAMPLE: System.Diagnostics.Process.Start(“c:\path\to\myfile.bat”) 3) Finally, you can … Read more

[Solved] VB If statement AND/OR

for simple .. use SELECT CASE Private Sub txtchange_Change() Select case Ucase(txtchange.Text) case “A” : lbloutput.Caption = “Apple” case “B” : lbloutput.Caption = “Banana” case “C” : lbloutput.Caption = “Cat” case “D” : lbloutput.Caption = “Dog” case “RED” : lbloutput.BackColor = RGB(255, 0, 0) case Else lbloutput.Caption = “Not Found” End Select End Sub 3 … Read more

[Solved] Why doesn’t this code work? (VB.Net)

To get the home directory of the current user use: Dim homeDir As String = System.Environment.GetEnvironmentVariable(“USERPROFILE”) Then copy the file: My.Computer.FileSystem.CopyFile(“D:\FrewGame\Game\FrewShort.lnk”, homeDir & “\Desktop\” & “Name.lnk”) 3 solved Why doesn’t this code work? (VB.Net)

[Solved] extract data from csv and rename files [closed]

First you must read the your CSV.. i suppose that is not too big, so do something like Dim MyCSV() As String = IO.File.ReadAllLines(“c:\my file.csv”) Then go ahead with a “For Each” line in your CSV For Each Line In MyCSV.ToArray Next In this For Each you must split the current line.. and i suppose … Read more

[Solved] why wont this visual basic script work?

I don’t have enough points to comment. First off, as others have said we can’t recreate this since we have no idea what your Form looks like or what you are expecting it to do. Secondly, you should turn on Option Strict in the Compile section of Project properties to avoid technical errors like ProgressBar2.Increment(0.6) … Read more