Visual Basic.NET

93K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi

I have a template field text box in my ASP.net GridView. I have managed to trigger
the VB.net code when the text in the GridView text box is changed. How do get the GridView
RowIndex and the text value? Also this code only triggers once you move out of the text box.
Is there a way to trigger it without having to do this?


               Protected Sub OnTextChanged(ByVal sender As Object, ByVal e As EventArgs)
        ClientScript.RegisterClientScriptBlock([GetType](), "alert", "alert('" & (TryCast(sender, TextBox)).Text & "');", True)

        Dim S As String
        Dim oRowIndex As Integer

        Try

        Catch ex As Exception

        End Try

    End Sub

Open in new window


1
0
Cloud Class® Course: Microsoft Office 2010
LVL 12
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Hello,

Changing Target CPU from X86 to x64 makes the designer have lot of errors. I am using visual studio 2017.
any suggestions?
0
How do I access Visual Basic from within Visual Studio 2017?
0
Is the latest version of Visual Basic part of Visual Studio 2017?  I really only need the latest version of Visual Basic for Winows 10.  That's all I really need.
0
I cannot recall how to  add a new column with  'EDIT,UPDATE,DEL...' buttons to a Datagridview In VB.NET (Win forms)

i'M USING TABLE ADAPTERS, DATASETS , bINDINGsOURCE.. ETC
a FILL EXAMPLE i'M USING IS:
        Me.Nichols_blanket_itemsTableAdapter.Fill_MRO(Me.ReportServerDataSet_MRO.nichols_blanket_items)

Open in new window



VB.NET  2017 against SQL 2008 database
0
I am filling labels on a form from two Access Database tables using VB.Net. My first SQL statement works perfectly and populates the datatable correctly. The second database connection is not working correctly but the SQL statement appears to be written correctly. In the second SQL statement I want to pull the QTY value from two different rows. The error I get during build is because the second data table is empty. Here is my code and thanks in advance Experts.

Dim cmd As New OleDbDataAdapter
        Dim cmd2 As New OleDbDataAdapter
        Dim iCalc1 As String
        Dim lCalc2 As Long
        ' Dim ds As DataSet
        Dim dt As DataTable = New DataTable()
        Dim dt2 As DataTable = New DataTable()
        ' ds.Tables.Add(dt)

        iCalc1 = TxtPartN.Text
        lCalc2 = TxtQty.Text
        Using conn As OleDb.OleDbConnection = CreateConnection()

            conn.Open()
            cmd = New OleDbDataAdapter("Select Customer, [Matl Code], [Box Code], [Part Wt Grams], [Piece Box] from [Parts Data] where [Part Number] = '" & iCalc1 & "'", conn)
            conn.Close()
            cmd.Fill(dt)

            LblMCode.Text = dt.Rows(0).Item(1)
            LblBCode.Text = dt.Rows(0).Item(2)
            LblMatNeed.Text = dt.Rows(0).Item(3) * lCalc2 / 453.59237 & " Lbs"
            LblPCount.Text = dt.Rows(0).Item(4)
            LblBoxNeed.Text = lCalc2 / LblPCount.Text

        End Using
        Using conn As OleDb.OleDbConnection = …
0
I need some advice on learning a new programming language.    I have background in computer graphics so I am a visual type of person.  I want to create a program that will help my wife back up her files to the external hard disks and learn how to code other programs.  Soon I am going to go over some online videos about programming terminology so I can learn different terms and what they mean.

Next:
I have written some short scripts in PowerShell and I like it a lot because it is very fast, but I also recently downloaded Visual Studio 2017 and am thinking about using Visual Basic instead because I think it would be easier for me to learn.

How fast is Visual Basic compared to PowerShell and what do you think I should use?
0
how do you restart a timer in vb.net?
i have tried timer1.stop then timer1.start  i have tried timer1.enabled = false then timer1.enabled = true  nothing seems to work
0
I have a VB.net program with a TextBox.  Currently I am checking if the user typed in a space and I alert the user if the box contains a space.  But I want to alert the user if anything other than an integer or comma is entered.  Would there be a simple way to determine if anything other than a integer or comma have been entered?  Here's the code I have for checking if a space was entered...
        If PortBox.Text.Contains(" ") Then
            MsgBox("Port box cannot contain spaces", MsgBoxStyle.Critical, "Port Error")
            Exit Sub
        End If

Open in new window

0
I have two forms for a vb.net program that access and access db. One form uses a dataset, bindingsource, and tableadapter and works fine. The other I used a function for thel connection and I get the error: Provider=Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine. My code is below.

Private Function CreateConnection() As OleDb.OleDbConnection
        Return New OleDb.OleDbConnection("Provider=Provider=Microsoft.ACE.OLEDB.16.0;Data Source;Data Source=|DataDirectory|\database.accdb;Persist Security Info=False")
End Function

I have a 32 bit version of office installed on my system and I have 1386 cpu selected.

Thanks experts for your help
0
Free Tool: ZipGrep
LVL 12
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Hi All,

I have a windows form with a listview control.
The listview has checkbox.

Everytime user check/uncheck the checkbox, I want to looping it and get checked checkbox.

At what event should I trap it ?

Thank you.
0
Hi All,

I want to show splash screen at application startup.

At the splash screen I want to do some background processing while progress bar is on progress.

 Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        ProgressBar1.Value += 2

        If ProgressBar1.Value = 100 Then
            Timer1.Dispose()
            Me.Visible = False
            Me.Close()
        End If

    End Sub

How could i do it ?

Thank you.
0
How do u bundle files in visual basic.net. What I mean is I have three files that need to goto programdata\reprint    how do I force the program to put those files  in dir path? Do I have to use file.write in the form load or is there a better way to package it. Maybe a package maker of some sort?
0
Is there a .Net library somewhere that validates emails.

And by validates... I mean...
Pass in a string and it checks for spaces, double periods @@ etc.
0
How can I show a custom error page for a 404 error. For example, if a 404 error occurs, the user is redirected to error404.aspx.

Code is vb.net
0
I have a routine to load a dgv from an SQL database.  The user can then click a button to output the dgv to excel.  All this works fine.
The export routine is basically
for each row in dgv1.rows
'output row
next

Open in new window

I have been asked to allow the user to choose to export either the full dgv, or just selected rows.
I figured if I define an object as a datagridview row collection, then set it to either all rows or selected rows as appropriate I could keep most of the same code, but I can't get the right syntax

dim rowcollection As DataGridViewRowCollection
If  UserChoice= "selected" Then rowcollection = dgv1.SelectedRows Else rowcollection = dgv1.Rows

for each row in rowcollection
'Output row
next

Open in new window

I get the error: Value of type 'System.Windows.Forms.DataGridViewSelectedRowCollection' cannot be converted to 'System.Windows.Forms.DataGridViewRowCollection'.        Please can someone see where I've gone wrong, or what object type I should define the collection as?
0
Hi All,

I want to set version of a application.

1. Where to put it ?
2. How to set version of application?

Thank you.
0
is there not a way to capture the output of psexec as it runs? i can do cmd.exe /k ipconfig and it works fine but when i do the following code using psexec it only returns the command prompt in the richtextbox.

dim proc as new system.diagnostics.process
proc.StartInfo.FileName = "cmd.exe"
        proc.StartInfo.Arguments = "/k c:\shared\psexec.exe \\" & ip & " -u administrator -p somepassword c:\shared\printme.exe " & ticknumber
        proc.StartInfo.CreateNoWindow = True
        proc.StartInfo.UseShellExecute = False
        proc.StartInfo.RedirectStandardOutput = True
        proc.Start()

       Dim output() As String = proc.StandardOutput.ReadToEnd.Split(CChar(vbLf))
        For Each ln As String In output
            RichTextBox1.AppendText(ln & vbNewLine)

        Next
        proc.WaitForExit()

Open in new window

0
When someone changes the value in a ComboBox in a VB.net program, I'd like it to check If the value is the word "Other".  How can I have that done right after they make their selection on that ComboBox?
0
Free Tool: IP Lookup
LVL 12
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

can't seem to figure out how to get the oldest directory that isn't empty. i have tried the following code but end up getting the wrong directory
Private Function checkdiff()
        Try
            Dim folder As New DirectoryInfo("c:\program files")


            Dim oldest As DirectoryInfo = Nothing

            For Each dir As DirectoryInfo In folder.GetDirectories()
                If oldest Is Nothing Then
                    oldest = dir

                ElseIf dir.CreationTime < oldest.CreationTime Then

                    If dir.GetFiles.Length > 1 Then
                        oldest = dir
                    End If
                End If

            Next
            Dim difference As Long
            If oldest IsNot Nothing Then
                difference = DateDiff(DateInterval.Day, Date.Now, oldest.LastWriteTime)

                MsgBox("The difference in the date is: " & difference.ToString() & " Directory is : " & oldest.FullName)
            Else
                MsgBox("The directory does not exist")
            End If
        Catch ex As Exception
            MsgBox(ex.ToString())
        End Try

    End Function

Open in new window

0
Hi All,

I have a mdi and login form.

I check user id and password at login form.

1. When user fills in user id and password correctly, and not close the login form by clicking "X" at right corner form, then It is ok, it back to mdi form and close login form.
2. When user fills in user id and password not correctly, and not close the login form by clicking "X" at right corner form, then It is ok, it back to mdi form and close login form.
3. When user fills in user id and password correctly, and  close the login form by clicking "X" at right corner form, then I want to close login form and mdi form.

I call login form from mdi form using showdialog.

How could I do it ?

Thank you.
0
I have received a program ( code included (x64)) to help kick open my posiflex cash drawer. I decided to create a test program (TestCD) to fist see if i could replicate the code. I can get the object to open and get the drawer to kick open but I cant close the object. Leaving it open causes the cash drawer to lose power. If someone can have a look at the two programs and maybe tell me what I am missing. I had a look at references and the forms but feel free to double check. I am not sure how much help the source code would be since you would need a cash drawer to test but please find below a link the the two programs. Ask if you need anything else and I will supply it asap.

https://www.dropbox.com/sh/sbdrhvwdbbyte2y/AAAEapPv36queudGr2hfKKfpa?dl=0

Regards,
Markus
0
In my .net code page there are the imports...
Imports System

Etc...

Throughout the pages I inherited there are 7-10
            Using objConn1 As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("strConn1"))
                Using oCom1 As SqlCommand = New SqlCommand

My question... is there any downside to adding a couple of further imports..
Imports System.Configuration
Imports System.Configuration.ConfigurationManager

And then simply using
             Using objConn1 As SqlConnection = New SqlConnection(AppSettings("strConn1"))

Seems to me it cleans up the page
0
How do you create a LINQ statement in Visual Basic to query an AccessDataSource?   I want the results to target a datasource that will be bound to a control.

Thanks
0
Hi
I am using the following VB.net code in my Excel Add-in to find all instances of a word on a spreadsheet.
The loop doesn't end at the end of the sheet  but rather just carries in. What extra code can I include
to not go past the end of the sheet?
                    
Dim blnFindError As Boolean = False

                    oFindWhat = "Total"
                    strSourceRange = oSourceWorkBook.Sheets(oSourceSheet).Cells.Address

                    Do Until blnFindError = True

                        Try
                            oFindAddress = oSourceWorkBook.Sheets(oSourceSheet).Range(strSourceRange).Find(
        What:=oFindWhat, After:=oSourceWorkBook.Sheets(oSourceSheet).Range(oFindAfterAddress),
        LookIn:=Excel.XlFindLookIn.xlValues, LookAt:=Excel.XlLookAt.xlPart, SearchOrder:=oSearchOrder,
        SearchDirection:=Excel.XlSearchDirection.xlNext).Address
                        Catch ex As Exception
                            blnFindError = True
                        End Try

                        oFindAfterAddress = oFindAddress 


                    Loop

Open in new window

0

Visual Basic.NET

93K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,