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

I'm printing a set of docs in a folder ~ I want to print it to the filesystem, basically an adjacent directory.

I actually have everything I need, except printing it to the file system as opposed to printer output.

I'm using process.startinfo method of course ~

any ideas where i may be able to look to, or even better, any suggestions?
I have a strange SoapHeader issue, which requires me to show the actor and mustUnderstand in a security header which is part of my SoapHeader. I have 2 questions, how can i set the value of these 2 attributes and how can i place them in my Security Element which is part of the SoapHeader.

This is what it should look like
<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
    <Security xmlns:wsse="" soapenv:actor="" soapenv:mustUnderstand="0">

Open in new window

Hello Experts,
I am working on a SSIS package, which was converted from DTS package.  In Script Task, I have some codes, where I am trying to check the existence of the network file.  For some reason, I am getting the runtime errors below.  Please let me know what is the error and how to fix it.

Thank you very much in advance.

Dim obj As Object
If (Not obj.FileExists(strNetworkFile)) Then
     Dts.Variables("TaskResult_Failure").Value = True
     Exit Sub
End If

Implicit conversation from 'Object' to 'Boolean'.
Late bound resolution; runtime errors could occur.
Operands of type Object used for operator 'Not'; runtime errors could occur.
Hello Experts,
I am trying to open a DTS package in Visual Studio 2015.  The goal is to convert it to SSIS package.   I was able to open the DTS package with error in Integration Services Script Task, where I have VB codes.  When tried to edit it, I received "This task does not have a custom editor. Use the properties window to edit properties of this task"
 message.  Any idea how to edit it?  Please try to help.  Thank you in advance.

Thank you!
I am getting an error :
Memory out / Invalid parameter exception when I run this code :
dtnew : Datatable

I am trying to export my images to powerpoint.

  If IsDBNull(dtnew.Rows(i).Item(3)) = False Then

                            Dim pictureData As Byte() = dtnew.Rows(i).Item(3)

                            'Create a stream in memory containing the bytes that comprise the image.
                            Using stream As New IO.MemoryStream(pictureData, True)
                                stream.Position = 0
                                'Read the stream and create an Image object from the data.
                                picture = New Bitmap(stream)
                            End Using

                            oldbitmap = New Bitmap(picture)

                            ppApp.Visible = True

Open in new window

Any suggestions ?
I'm in the process of creating a Web page which links to our company database and display data into 2 GridViews. I intend for both of them to be displayed side by side.

I'm using Microsoft Visual Web Developer 2010 Express for this project.

Therefore, I added a table and separated it into 3 columns:

<asp:Table ID="Table3" runat="server" Width = "100%" Font-Bold="True" 
                Font-Names="Arial" Font-Size="Large" BackColor="#B9FFFF" CellPadding="0" 
                CellSpacing="0" Height="18px">

                    <asp:TableCell Width = "45%"> Status Time Collector</asp:TableCell>
                    <asp:TableCell Width = "10%"> &nbsp </asp:TableCell>
                    <asp:TableCell Width = "45%"> Actual Quantity Data Collector</asp:TableCell>

Open in new window

The result is as follows, (the blue row is the table):
I then try to insert the GridView into the table by dragging GridView into the design and move it within my <asp.table> code:

<asp:Table ID="Table3" runat="server" Width = "100%" Font-Bold="True" 
                Font-Names="Arial" Font-Size="Large" BackColor="#B9FFFF" CellPadding="0" 
                CellSpacing="0" Height="18px">

                    <asp:TableCell Width = "45%"> Status Time Collector</asp:TableCell>
                    <asp:TableCell Width = "10%"> &nbsp </asp:TableCell>

Open in new window

we are trying to send email from the program via our exchange server  . vb application reside sever is and exchange server ip .
we have given the exchange serevr email mail box and server details with user credentials  . but still exchange server is rejecting the mail with the following error : unable to relay  "
Do we have to all the vb application serevr details into exchanger server  ? or any other setting
please advice how we can enable the  external email sending via our exchange server

Im relative new to programming world using VisualBasic.NET and I want to know how can I connect this language to a MySQL database. I want to develop an app using database integration and make a complete CRUD (Create, Read, Update, Delete, Search) functions.

Please, I hope someone helps me.

using windows forms-visual basic 2013, I'm working on task to scan range of IP's say to Looping over IP's, if IP ping check if computer return computer name ans OS name

this part done with no issues using WMI, IF wmi connected to IP successfully (this mean IP assigned to computer) I collect required data if not I cancel this IP.


if IP is Printer I need to return printer type, model and other available data

how I can Collect Network printer data?

I need to get result like this

IP.........................Printer type........Model

=========== ============= ======== HP................. MFP3050 .............printer model

and so on

I searched over web and all posts used to collect data from INSTALLED printers on local or remote computer and i don't need that.
I have an application written using vb 2015 that writes to some modems using the Ports.SerialPort class through COM ports.
It works fine on my old laptop running Windows 10 and another I've tested it on.
I have just installed vs 2017 on a new lap top -( Windows 10 ) and although the COM ports are present in device manager (as USB Serial Ports) and I can send messages out through the SerialPorts, I just never receive a Data received event back.
I have another device which is also connected as a USB Serial device (rather than Serial Port) that does return data.
If I compile the application and run it on my old laptop, it still works.
Ideas anyone?!?
How can I show a custom error page for a security error. For example, if a user enters forbidden text into an input box such as: <script>alert(123)</script>, the user is redirected to errorforbidden.aspx.  I have ValidateRequest="true".

Code is
I have three locations that I custom develop for, and each location has the exact same code on each page.  However, each page has site dependent code (if url = 123 then this code, else this code, etc).  this allows me to have one master copy of each page and then distribute that one page to all 3 locations.

so, right now, I just do a copy paste of file a to location a, location b, and location c, all on different servers, all in different physical locations (but with a tunnel built between all 3 locations).

I'd like to have a drag and drop, or double click, something that makes my file I modified "live" without having to copy the file to 3 locations.  My initial thought was some sort of ftp where I double click the file and it makes the file live to all 3 locations, but I'm not certain that is possible.

Any suggestions?
I can't add font property into property grid through xml.
it's show serialization error. how to do this ?

Private _windowFont As Font = New Font("Arial", 8, FontStyle.Regular)
   Public Property FontName() As Font
           Return _win[embed=file 1328036]dowFont
        End Get
        Set(ByVal Value As Font)
            _windowFont = Value
        End Set
    End Property

Open in new window

Dear Experts,

I have an website that uses identity 2.1 (I'm pretty sure > 2.0 anyways as near as I can tell). It is written in visual basic. I ran into a weird issue the other day where people were logging in and getting this viewstate error:

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

So I followed the advice I found in the microsoft article and added a machine key to the web.config file so that no matter what it (hopefully) shouldn't get that error again.

Once the machine key was changed to one that I set now we had issues with anyone with an already existant authorization cookie on their computer, they were unable to login. I believe it's because the machine key that I set no longer matched the one that was used in their cookie. I'm not entirely clear how, but apparently it's part of how it's encrypted. If they clear their cookies, all is well - then they could login.

So one bit of advice I found searching on the web sounded super simple and super-easy. They recommended that you have some sort of set key in your web.config, like a guid or something and then you add it to your cookie also. Then, when you load the cookie, you can check the key and if it doesn't match your server key, somehow you invalidate the cookie.

I basically spent all day trying to figure out …
Imports System.Data.DataTable
Public Class Form3
    Dim table As New DataTable("Table")
    Dim index As Integer
    Dim DataGridView1 As String

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        table.Columns.Add("Nom", Type.GetType("System.String"))
        table.Columns.Add("Prenom", Type.GetType("System.String"))
        table.Columns.Add("Date de naissance", Type.GetType("System.String"))
        table.Columns.Add("Domicile", Type.GetType("System.String"))
        table.Columns.Add("Numero de telephone", Type.GetType("System.String"))
        DataGridView1.DataSource = table
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        table.Rows.Add(TextBoxN.Text, TextBoxP.Text, TextBoxDdn.Text, TextBoxD.Text, TextBoxNdt.Text)
        DataGridView1.DataSource = table
    End Sub

    Private Sub btnsuivant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsuivant.Click
    End Sub

    Private Sub btneffacer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneffacer.Click
    End Sub

    Private Sub Btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClear.Click
        'clear TextBoxes
        TextBoxN.Text = ""
        TextBoxP.Text = ""
        TextBoxDdn.Text = ""

Open in new window

My company has a folder of .dwg  images (AutoCAD/Assembly Drawings ) ranging from 200-500 docs.

My goal is to get these in TIFF format for legal review.

Now I've written a program that uses eDrawings free viewer to open these and read the images into memorystream ~ the reason for this is that any corrupt file isn't read into memory stream and is therefore skipped. So everything up to this point is simple but it gets a little complicated from here.

Some of the images, say 3-5% are zoomed out on a specific area, without any other pixellation on the pictureframe.

In my attachments "pic1" and "pic4" are standard images. "Pic 5" is a tiny dwg drawing in the corner, however if you zoom in it ("Pic 6") becomes a lot bigger and more noticeable, and we aren't losing any other  parts of the image (pixels).

My question is: Is there code that I can use that would tell my program

"save the image into memorystream as full screen if it takes up less than 1/15 of the pictureframe/picturebox and if there are no other pixellations"

Like even an idea where to start looking would be nice.

I am thinking about something:

if imageheight < 1/15 of frameheight   AND   imagewidth < 1/15   framewidth then  print image fullscreen

Any thoughts?
i have draw one bitmap file using graphic. some times application has through Out of memory or invalid parameter  exception. am using Dispose and flush everyone to dispose a object some time its drawn 10000 images sometimes its drawn 20 images only can you give idea. actually the drawing process happened inside the loop but that functionality calling through thread only.
In ADUC (and VB.NET) I can use a LDAP query to return objects using GUID



And this works well for objects which exist

But can't get it to work for deleted objects





But doesn't show any result, where if I used the same GUID in powershell e.g.

 get-adobject -identity ea33990b-7356-48e4-b63a-a31a3b0b3809 -IncludeDeletedObjects

it returns:-

 Deleted           : True
 DistinguishedName : CN=LXXX64\0ADEL:ea33990b-7356-48e4-b63a-a31a3b0b3809,CN=Deleted
 Name             : LXXX64
 ObjectClass       : nTDSConnection
 ObjectGUID       : ea33990b-7356-48e4-b63a-a31a3b0b3809

Any ideas why the LDAP query is not working for deleted items but the powershell one is?

I need to convert get name of an object from its object GUID in my VB app and currently best way I know in VB.NET is using System.DirectoryServices and a LDAP query
We are creating hundreds of C#.NET forms by reading the VFP source and writing the .cs code.

The height, width, top, and bottom of all objects are identical.  The font is identical (exception MS Sans Serif is changed to Microsoft Sans Serif.  Also same font size.

The spacing and size of the objects are slightly different.  Enough to make a mess when the objects(labels, textboxes) are close together.

We need them to be identical. Any suggestions?
Hi.  I'm using and Visual Studio 2008 and Windows Forms.

1 WIth the datepicker object, I've blanked out the value initially then I let the user choose a date from the popup calendar.
After a user chooses a date from the popup calendar, then their date is populated into the form's field; however, if they change their mind and want it to go back to blank, it doesn't let them do that -- How do I allow a user to choose a blank option?

2. In a different datepicker field, I want it to be readonly so I've set the property to enabled=false.  Problem is it doesn't look greyed out (it's still white) so user thinks it's a field they're supposed to enter.   How do I make a disabled datepicker field greyed out?
I have main form which has a menu(toolstrip) and after the menu i have put a panel.From this menu a user selects an option lets say forexample,customers another form is displayed with list of customers but inside the panel.Am using listview to display a list of customers.When user double clicks on one of customers another form is displayed with form fields filled with customer details ready to be edited.When user finishes editing he saves the details and records are saved without a problem.Now what i want is to refresh the list on form within the panel.I have tried "frmCustomers.pull_customers_List" but it doesn't work.What could be the solution?

NOTE:pull_customers_List is the function used to query cutomers from the DB and display on listview.

Dim frm As New frmCustomers
frm.TopLevel = False
frm.Parent = Me.Panel1
*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

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 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?

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,