[Solved] Converting the For Next Loop into a For Each Loop

Good start in your comment but what is in your array is strings not integers so you would loop through the strings. Dim TeamString(31) As String For Each Team As String In TeamString MessageBox.Show(“Team Name:” & Team) Next 0 solved Converting the For Next Loop into a For Each Loop

[Solved] vb.net late bindings issue even after setting the variable

note that you have to referance Microsoft.Office.Interop.Excel assembly: project>>add reference>> check Microsoft Excel x.xx Object Libary Imports Microsoft.Office.Interop Public Class Form1 Private exapp As Excel.Application Private xlwb As Excel.Workbook Private xlws As Excel.Worksheet Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load exapp = New Excel.Application xlwb = exapp.Workbooks.Add() xlws = xlwb.Worksheets.Add() xlws.Name = … Read more

[Solved] I need to convert this function from C# to VB.net – Convert INT to multi character string [closed]

If you’re being LAZY and i mean lazy you can use http://converter.telerik.com/ Here’s the output for you: Public Shared Function getColumnNameFromIndex(column As Integer) As String column -= 1 Dim col As String = Chr(Asc(“A”) + (column Mod 26)) While column >= 26 column = (column \ 26) – 1 col = Chr(Asc(“A”) + (column Mod … Read more

[Solved] Math for VB.net Progressbar 0 to 100%

Not sure if I get your question correctly… First, if what you want is to show a progressbar with some value that’s not 100… why not simply set the progres bar’s Maximum to your value (156761 in your example) and set Value to whatever progress it has? Now, if the progress bar for whatever reason … Read more

[Solved] Performance issue with this code [closed]

In short: You should create,open,use,close,dispose Connections where you’re using them. The best way is to use the using-statement. By not closing the connection as soon as possible, the Connection-Pool needs to create new physical connections to the dbms which is very expensive in terms of perfomance. Using conn As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(“ConnStr”).ConnectionString) Using insertCommand As New … Read more

[Solved] How to keep two For Each loops at the same level [closed]

you may use a for loop for one and an array incremented manually for the other like so: Provided both these collections(or arrays) have the same number of elements: Dim strSQLCommand As String Dim intProductIdIndex as integer=0 For Each productQtys In productQty strSQLCommand = “INSERT INTO Orders(SessionID, productID, qty, orderDate) ” & _ “Values (‘” … Read more

[Solved] VB.net .. Error using objects? [closed]

The problem is that .FaceValue is not a property of a PictureBox. You would instead need to grab the FaceValue from your Deck based upon the cards generated. In response to your comment below, try something like this… Dim card1 as new card = deck.DealCard() card1PictureBox.Image = GetCardImage(card1) So, that’s how you set one of … Read more

[Solved] How to count and update label without saving in database in vb.net? [closed]

You could set a ‘baseDate’ in your code as ‘1/13/2018’ in order to compare it with today’s date. Then you just need to get the days in between, and get its “module 3” value: Dim baseDateString = “14/01/2018” Dim baseDate As Date = Date.ParseExact(baseDateString, “dd/MM/yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo) Dim datetimeBetween = DateTime.Today.Subtract(baseDate) Dim daysBetween = datetimeBetween.Days Dim … Read more

[Solved] Select item from ComboBox to open web links on WebBrowser?

Try this… Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Select Case ComboBox1.SelectedItem Case “Please Select” MsgBox(“ERROR – No selection made in dropdown box!”) Case “Google” WebBrowser1.Navigate(“www.google.com”) Case “Microsoft” WebBrowser1.Navigate(“www.microsoft.com”) Case “Stack Overflow” WebBrowser1.Navigate(“www.stackoverflow.com”) End Select End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ‘ ComboBox1.Items.Add(“Please … Read more

[Solved] vb.net timeadding from two textbox

Split the strings in the TextBoxes into an array. The first element will contain the hours and the second element will contain the minutes. The c following the split character tells the compiler this is a char not a string. Use the constructor of the TimeSpan structure to create TimeSpans. The constructor takes 3 arguments, … Read more