Visual Basic.NET





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

How can I delete the control when I move off the mouse hover over if a label. The code is below:

  Private UserControl As UcGauges = New UcGauges
    Private Sub lblGaugeID_EditScreenDescription_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblGaugeID_EditScreenDescription.MouseHover
        Using tempUcGauges As Form = New Form
            tempUcGauges.Location = New Point(300, 300)
            tempUcGauges.TopMost = True
        End Using
    End Sub
 Private Sub lblGaugeID_EditScreenDescription_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblGaugeID_EditScreenDescription.MouseLeave

    End Sub
End Class

Open in new window

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.

*Using Telerik controls here..

I am having problems trying to get a radAsyncUpload control to show up in a row of a radGrid when the row is selected by clicking anyplace on that row.  I am guessing I need to toggle the radGrid into Edit mode once a row is selected?  I have the radAsyncUpload control in the EditItemTemplate of the radGrid for the "Upload" column.  I would then like for the single upload be performed before any other row may be selected to upload another file.

RadPageView4 is the section in question.

<telerik:RadTabStrip RenderMode="Lightweight" ID="rdTab" runat="server" Orientation="HorizontalTop" Align="Left" MultiPageID="RadMultiPage2" SelectedIndex="0">
		<telerik:RadTab Text="Status" Selected="True" ImageUrl="~/images/RedDot.png" ></telerik:RadTab>
		<telerik:RadTab Text="Ship Group"></telerik:RadTab>
		<telerik:RadTab Text="Tube Groups"></telerik:RadTab>
		<telerik:RadTab Text="Regulatory Work"></telerik:RadTab>

<telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0" Width="50%">
		<telerik:RadPageView ID="RadPageView1" runat="server" Width="100%">
			Approved: <asp:Label ID="lblApproved" runat="server" Text="False"></asp:Label>
			<asp:Button ID="btnApproval" runat="server" Text="Submit Approval" Enabled="False"/>

		<telerik:RadPageView ID="RadPageView2" runat="server" Width="100%">

Open in new window

0 and SQL Server 2005:

On a master detail form I need to be able to have a DGV that that is pre - populated with a checklist that can be edited and contains checkboxes that can be checked.

Every instance of the master form will have a DGV with exclusive data

Hi I am sending an email blast and on email I am connecting each button with userid so if any user who get email click that email then  his click can be recorded. For eg Button click is like this:

previously I was using 3.5 framework and it was working fine there but now after switching to framework 4.0, instead of going to page Email.aspx
its trying to go to, FYI I am doing URL rewriting also.

   How I can fix this problem. For fixing issue I had to remove http tag so when I call page like below then its working

  Please help
I would like to extract the value for:  b.supplier_name.
Not sure how to accomplish this...
thanks much,

                Dim queryString As String =
                        "SELECT a.SupplierID,a.Supplier,a.Col1,a.Col2,a.Col3,b.supplier_id,b.supplier_name
                        FROM ReportServer.dbo.supplier_pricing a
                        INNER JOIN P21.dbo.supplier b
                        ON a.SupplierID = b.supplier_id
                        WHERE a.SupplierID = @supplierID"

                Dim command As New SqlCommand(queryString, connection)
                command.CommandText = queryString
                command.CommandType = CommandType.Text

Open in new window

I want to add a label into my Splitter Container that is on a form and the splitter is dock full to the form. What is happening is that the label does not appear on the scplitter control panel 1.

How can I get the label to appear on splitter control panel 1?
I would like to get a list of available domains from my office 365 account and push them into a dropdown list.  Anyone know how to get this done in  Does anyone know of a good way to do this?

Thank you in advance...
I have a string for RevNo
I need a function that splits the numeric and alpha

For example  1A should be split as  1   A  ( split as Major and minor)
                       10A should be             10  A

Currently I'm trying to imitate on how to export data from access 2000 to a fixed width text file, and so far i have successfully exports data to text file only with fixed width.
So when I try to upload the file to a third party software that we use it says invalid format.
When this error occurs i suspect it is because i don't have a start position.

I would like to ask question on how create  and format a text file with fixed width and start position in .

This is the initial tutorial i've followed:
Is there a way I can create my own API to eDrawings for solidworks? There is one out there, but it requires an AutoCAD license.

Basically a client is giving us dwg files, we use eDrawings to view and print them.

So I would rather batch print them. Hence an API in visual studio to eDrawings would be nice. From there I could do the rest.
I haven't really created API's before, so I'll take any available advice.

 Would anyone be able to set me on the right path?
Cloud Class® Course: Ruby Fundamentals
LVL 12
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

       ElseIf operation = 8 Then
            TextBox1.Text = Math.Cos(fo)

Open in new window


I have this json coming from an REST api. I now want to make a representaion of it in my site (I use for the moment). But I don't fully get it to work when I create the classes representing the json and deserialize it. This is how the json looks like when I copy it form Postman:
    "data": {
        "type": "vehicle",
        "attributes": {
            "regno": "HCA015",
            "vin": "WF0MXXGBWMDP17671"
        "links": [
                "rel": "self",
                "uri": "vehicle/vin/WF0MXXGBWMDP17671"
                "rel": "biluppgifter",
                "uri": ""
        "basic": {
            "data": {
                "make": "Ford",
                "model": "GALAXY 2.0 TDCi",
                "status": 2,
                "color": "Svart",
                "type": "PB",
                "vehicle_year": 2013,
                "model_year": 2013
        "inspection": {
            "data": {
                "latest_inspection": "2016-09-19T00:00:00+02:00",
                "inspection_valid_until": "2018-09-30T00:00:00+02:00",
                "meter": 38650,
                "next_inspection_range": [
        "status": {
            "data": {

Open in new window

Tried a lot to identify the root cause of this error but totally failed. Any suggestion will be highly helpful.

    Dim Smtp_Server As New SmtpClient
    Dim e_mail As New MailMessage()
    Smtp_Server.UseDefaultCredentials = False
    Smtp_Server.Credentials = New Net.NetworkCredential(txtFrom.Text, txtPassword.Text)
    Smtp_Server.Port = cmbPort.Text

    Smtp_Server.EnableSsl = cbxSSL.Checked
    Smtp_Server.Host = cmbHost.Text

    e_mail = New MailMessage()
    e_mail.From = New MailAddress(txtFrom.Text)
    e_mail.Subject = "Auto Email"
    e_mail.IsBodyHtml = False
    e_mail.Body = "Hi, This is test mail."

    MsgBox("Mail Sent")

Catch error_t As Exception
End Try

Open in new window

Hi, if anyone helps me to write the better way to write this code, more appreciate. because inside code lot of If conditions,May be using sql
  private void cmbRequisitionNumnber_SelectedIndexChanged(object sender, EventArgs e)
decimal ReqCost = req.RequisitionCost(cmbRequisitionNumber.Text.ToString());
            lblcost.Text = ReqCost.ToString();


            if (ReqCost >= 1000 && ReqCost< 5000)
                cmbApprover2.Enabled = true;


            if (ReqCost >= 5000 && ReqCost < 10000)
                cmbApprover2.Enabled = true;
                cmbApprover3.Enabled = true;


            if (ReqCost >= 10000 && ReqCost < 20000)
                cmbApprover2.Enabled = true;
                cmbApprover3.Enabled = true;
                cmbApprover4.Enabled = true;


            if (ReqCost >= 20000 && ReqCost < 80000)
                cmbApprover2.Enabled = true;
                cmbApprover3.Enabled = true;
                cmbApprover4.Enabled = true;
                cmbApprover5.Enabled = true;


            if (ReqCost >= 80000 )
                cmbApprover2.Enabled = true;
                cmbApprover3.Enabled = true;
                cmbApprover4.Enabled = true;
                cmbApprover5.Enabled = true;
                cmbApprover6.Enabled = true;


Open in new window


Is there anybody who could help us to solve this issue. What we want to do is to select 2 or more attachments of an e-mail in Outlook 365 and drag and drop these files on a listbox. The files should be saved in a folder as file and the name of the file added to the listbox.

In the DrapDrop event of listbox, we handle the e.Data if "FileGroupDescriptor" is a member of the data (GetDataPresent).
It is possible to extract the number of files that are dropped and we can extract theses names of the data. See the example below ("Get names of files that are dropped").
This works fine. But now we will get the data of each separate file from the stream. The first one is not a problem, see 'Get memorystream of data of file' in the sample code below. But how can we get a memorystream of the second, third etc files of the drop action?
Any help will be appreciated

    If e.Data.GetDataPresent("FileGroupDescriptor") Then

      ' Get names of files that are dropped
        Dim theStream As Stream = CType(e.Data.GetData("FileGroupDescriptor"), Stream)
        Dim fileGroupDescriptor(theStream.Length) As Byte
        theStream.Read(fileGroupDescriptor, 0, theStream.Length)
        Dim liNrFiles As Integer = fileGroupDescriptor(0)
        Dim fileName(liNrFiles) As System.Text.StringBuilder
            For liY = 1 To liNrFiles
                fileName(liY) = New System.Text.StringBuilder("")
                Dim i As Integer = 76 + ((liY - 1) * 332)
VB.Net 2012 and SQL

I'm trying to add a dropdown to filter the SQL database before selecting the second dropdown locations.  This is the code behind I currently have and is working as expected.  How can I add another dropdown to select the county before selecting the location?

Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

Public Class WebForm9
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

            'Dim MyDate As Date = "00/00/0000"
            'datetxtbx.Text = MyDate.ToString("mm/dd/yyyy")

            DropDownLocation.Items.Add(New ListItem("--Select Location--", ""))

            DropDownLocation.AppendDataBoundItems = True

        Dim strConnString As String = "Connection String"

            Dim strQuery As String = "select ID, Location from ExitLocation"

        Dim con As New SqlConnection(strConnString)

        Dim cmd As New SqlCommand()

        cmd.CommandType = CommandType.Text

        cmd.CommandText = strQuery

        cmd.Connection = con



                DropDownLocation.DataSource = cmd.ExecuteReader()

                DropDownLocation.DataTextField = "Location"
                DropDownLocation.DataValueField = "ID"


        Catch ex As Exception

I have a VB.NET Windows forms application.  I'm trying to load a pdf file into the WebBrowser object.  I get a gray background and that's it.  It seems to work on another computer.  I've reinstalled the Adobe Reader application several times, rebooted.  the browser loads fine with internet urls, text files, etc... just not PDF files.  I'm thinking there is something on this computer that maybe causing the problem but I am not getting any errors. I developing in VS 2017 and using .NET 4.6 framework.

I also had the same problem when trying to use the Adobe COM object.  Just get a gray background and the initializing …. starts and then it errors out.  Worked fine on other computer.
In my application i used to work with multiple form(Metro) and when i get a messageBox click event minimize the other forms except the form which generates messageBox.
How can i fix this???
I'm getting the following error after upgrading to SSL.  Not sure what portion of the I need to change.  Any help is appreciated.

During Login into site I get the error.
The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL.

The Stack Trace is:
[HttpException (0x80004005): The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL.]
   System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath) +9811908
   System.Web.UI.WebControls.Login.AttemptLogin() +192
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +260
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean …
Free Tool: Port Scanner
LVL 12
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Currently i am using

Dim myResponse As New Http.HttpResponseMessage
 myResponse.StatusCode = "203"

Looking for some reference or sample code which will let me do following;

a) set the HTTP Status Code
b) set the Content-Type in Header
c) Return txt like json or XML
i m trying to embed a text watermark on a pdf document in ,can u please help me with that .Here is the code:Public Shared Sub AddWatermarkText(ByVal sourceFile As String, ByVal outputFile As String, ByVal watermarkText() As String, _

                                       Optional ByVal watermarkFont As iTextSharp.text.pdf.BaseFont = Nothing, _

                                       Optional ByVal watermarkFontSize As Single = 48, _

                                       Optional ByVal watermarkFontColor As iTextSharp.text.Color = Nothing, _

                                       Optional ByVal watermarkFontOpacity As Single = 0.3F, _

                                       Optional ByVal watermarkRotation As Single = 45.0F)


        Dim reader As iTextSharp.text.pdf.PdfReader = Nothing

        Dim stamper As iTextSharp.text.pdf.PdfStamper = Nothing

        Dim gstate As iTextSharp.text.pdf.PdfGState = Nothing

        Dim underContent As iTextSharp.text.pdf.PdfContentByte = Nothing

        Dim rect As iTextSharp.text.Rectangle = Nothing

        Dim currentY As Single = 0.0F

        Dim offset As Single = 0.0F

        Dim pageCount As Integer = 0


            reader = New iTextSharp.text.pdf.PdfReader(sourceFile)

            rect = reader.GetPageSizeWithRotation(1)

            stamper = New iTextSharp.text.pdf.PdfStamper(reader, New System.IO.FileStream(outputFile, IO.FileMode.Create))

I have a panel on a form and inside the panel I have a listview control. I would like to be able to resize my listview area with my mouse so that I can pull the window down to see the multiple lines.

does anyone know How to do this while the listview is docked inside the panel on the form?
How do i read a pdf file which has some pages but an structure of information by each one.
I need to read every page record and use that information to put on a database.
How to delete an AD User account and mail contact using application written in VB.Net?
Please explain how to configure the permission required and the source code to achieve that.
I have a Visual Studio solution with many projects inside. It has some custom DLL files and DLLs from NuGet package. Considering when check in to VSTS, the DLLs inside bin folder will not be checked in to VSTS. And if I put the DLL files in a new folder under solution root directory, any project changes will have manually update in the folder.
1. What is the recommended structure for such case?
2. Can I check in the solution so that all the projects also has versioning?
3. Anything that I should be aware of when custom DLL or NuGet package update to prevent project error due to version difference?

Visual Basic.NET





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,