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

Hello experts

Its been a while since ive played in visual studio as ive been more a powershell person and looking for a bit of guidance. I was mainly writing this as a vb app instead of powershell for performance reasons in terms of faster launching but you might indicate this is incorrect. Amongst other things the app I was writing needs to work with the windows 7/10 credential manager to check if a credential already exists or not and if it doesn't preadd the username and target name to minimise confusion amongst endusers who are typing the incorrect credential and causing problems. So basically the command line I need to encapsulate into vb is

Cmdkey /list:ourtarget.provider.local

which will either return the credential details or say * NONE*. In powershell its relatively simple to pipe it with | foreach-object and check if the credential is there and im just wanting advice on how to do similar in VB or is there a better inbuilt way for vb to work with the windows credential manager ? I'll be adding the credential if it doesn't exist using info pulled from our AD which ive already got sorted in the code just a bit stuck on executing the external cmdkey program from within vb and parsing it
New feature and membership benefit!
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Hi Experts,

I am trying to prevent textbox TextChanged event when any button is clicked. So I wrote the following code. When I run the program It is saying there are errors in the progeam. But it is now showing any error. If I take away the hidden field code then it runs fine.

Please help.

Thanks in advance.

<asp:TextBox ID="txtSelectedDate" runat="server" CssClass="MediumTextBox" AutoPostBack ="true" ></asp:TextBox>
<asp:Button ID="cmdPrevious" runat="server" Text="< Prev" OnClientClick="setButtonClicked();" onclick="cmdPrevious_Click" />
 <asp:Button ID="cmdNext" runat="server" Text="Next >"  OnClientClick="setButtonClicked();" onclick="cmdNext_Click"/>
 <asp:HiddenField ID="HiddenField1" runat="server" Value="false" />

         function setButtonClicked() {
             document.getElementById('<%= HiddenField1.ClientID %>').value = 'true';

ASP code

  If HiddenField1.Value = "false" Then

      HiddenField1.Value = "false"
end if
I am trying to resize the Form in a run time. Depending of the user choice it could be either original size or its height should be increase. However Property "Size" is not available, so MyForm.Size = New Size(100, 200). How can I resize the form? Please help.
Hi experts.
I have a form.  The form has two flow layout panels created at run time.
The flowlayout panels contain custom controls.
I want the user to be able to select a custom control in a flow layout panel.  
When the item is selected, it should change the background of the custom control to red.  
When the user selects a different control, it sets the first custom control to blue and sets the new one to red.  
Some controls are added from a DB read while others are created from the user via drag and drop.
sample magnets.  Blue from DB load, yellow from drag and drop
If the controls are all from a DB read, code works.  However items created from drag and drop do not change the highlighting.

Code as follows:

Private _StoredMagnet As LaborMagnet

 Private Sub MyMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        '  Dim source As Control = CType(sender, Control)
        Dim MySelectedControl As Control = DirectCast(sender, Control)
        If TypeOf MySelectedControl Is LaborMagnet Then

            'IF a magnet is already clicked it is stored as the selected magnet
            If Not _StoredMagnet Is Nothing Then
                'If a magnet is stored, change that magnet to blue.
                DirectCast(_StoredMagnet, LaborMagnet).BackColor = Color.SteelBlue
            End If

            'Set the currently clicked magnet to the selected magnet
            _StoredMagnet = DirectCast(MySelectedControl, LaborMagnet)
            'Change the 

Open in new window

I want to create a timed screensaver
I have defined a report in ReportViewer and it runs fine. I'm developing in VB.Net using VS 2013.

Now I'd like to narrow the rows selected to a given month (my rows all have a date field). So I tried to define a filter on the group I'm using to drive the report, but this fails, because my expresiion for the filter is for example:
 Set expression for value:
 1 =DateSerial(Year(Now), Month(Now), 1) -1

This sets the date to the last day of the previous month in VB.Net, but ReportViewer tells me that: >>operator '-'  is not defined for types 'Date' and 'Integer'<<  and refuses to run !

In the same vein, I have an even more complicated expression:

IIf(Month(Now)>1,DateSerial(Year(Now), Month(Now)-1, 1),DateSerial(Year(Now)-1, 12, 1))

which sets the date to the first day of the previous month, taking in account the special case of the current month being January, therefore the previous month being december of the previous year. Needless to say, that expression is also invalid as a filter according to ReportViewer.

What am I doing which is tripping up RV ? How should my expressions be ?

Thanks for help
Hi all,
is any way to send a file who is located in external iis folder!

Dim stream As FileStream = File.OpenRead("e:\test.docx")

Open in new window

that is an example works in my local drive,
what is the proper sintax for a iis folder location!
Is it possible?
I am in need for a method to convert from a richtextbox to html so I can run a RDLC report. It hs to be in the following format:


<div><font face="Engravers MT" size=4>Given on this day [PrintDate]</font></div>,

OR does anyone know a better way to take a Richtextbox stored in the DB and print it to a RDLC. We are a nonprofit an paying for components is not a option

I have a list of business name and their address including zip code in different columns which is quite long and can't do manual search on google. Now I want to pull information about their website, email and phone on google. I am just curious to know if its can be done.

Can we do a similar search thru Facebook?

If So, I am looking for both solution

I am new to VB / Macros. So, looking for detailed instructions help with code as well as how to apply it.

Thank you!
[Webinar] How Hackers Steal Your Credentials
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Can anyone recommend the best course for mobile development.
I have few desktop projects to be migrated to mobile.
Any suggestions on this.

In my winforms .NET application I need to merge two different datatables that each have a field they match on. One is the parent, one is the child. The child has more rows. In Master Table the field to match is "Rec_ID". In the child table the field that matches Rec_ID is "Order ID". They tables have already been populated with data at the time to make the match. Merge does not work as the schemas of the tables are quite different. Relations do not work with tables populated after the fact. I am going nuts here. Thank you.
I have a screen where the user can search on an ID and if there are multiple records(and there usually are) I have a < > symbols to go to the next or to the previous record. This fills the fields with the values and does its thing. My issue is that the screen will flicker everytime I go to the next record. I put an UpdatePanel around it and this didnt fix it and Im wondering if there is anything I can do to make this just go away!  My code is below and Im curious if there is anything I can do with the UpdatePanel to make it stop flickering. Any other suggestions are welcome too.

            <div style="width:350px">
                <asp:UpdatePanel ID="upScroll" runat="server" UpdateMode="Conditional" >
                        <table style="width: 350px">
                            <tr id="trScroll" runat="server" align="center" style="width:350px;" >
                        <%--<td style="width:0px;" >

                        <td id="tdRecordScroll" runat="server" align="center" style="border-collapse:collapse;"> <%-- vertical-align:middle; --%>                     
                            <asp:ImageButton ID="previous" runat="server" ImageUrl="~/images/previous_blue.png" OnClick="previous_Click" visible="false" ImageAlign="Middle"/>
                            <asp:ImageButton ID="next" runat="server" ImageUrl="~/images/next_blue.png" OnClick="next_Click" visible="false" 

Open in new window

i have developed application using which have sql server 2008 database and also includes crystal reports. and i want to create .exe of project. For distribution. I am trying to do this with visual studio 2010.. Using traditional selecting Setup And Deployment Projects..but after clicking on primary output it give message like.."" The following files may have dependencies that can not be determinited automatically. Please confirm that all dependencies have been added to the project c:\windows\system32 \macromed\flash\flash.ocx..""  Please help me to solve this..
Hello friends I have a problem with DIGITALPERSONA ONE TOUCH READER BIOMETRIC ,I cant take and save image of finger to jpg,here is a example of my code.....

Private Sub DPFPEnrollmentControl1_OnComplete(ByVal pSerialNumber As String, ByVal lEnrolledFinger As Long)
Dim oPicture As IPictureDisp
Set oPicture = DPFPEnrollmentControl1.EnrolledFingersMask
Picture1.Picture = DPFPVerificationControl1
End Sub

really I dont know how to resoved it if anyone can help me would be a GREAT help......thank you for you time.
So, a client would like to be able to have their employees receive a message if they haven't entered in time within the last 7 days. Specifically Monday - Monday at 12:00PM. If the employees have not entered in time by noon, they should be locked down and only allowed to enter time for dates that fall within the last 7 days. The code is written in VB.NET and utilizes SQL and Stored Procedures heavily. I was hoping to get some ideas in regards to possible ways to go about this.
I am trying to find the best support for this process. I want to be able to make a call to an excel grid in any version of  Excel (2003-2016) so that I can export the setting.

What do I need in order to do this?

Thanks in advance.
I have just started to work with WPF using and have had trouble getting the DataGrid to work with the Access Database (Jet) that holds my data.  I learn best through examples and I would be grateful if someone can give me sample code (both XAML and VB) to solve the following situation.

I have a DataGrid as follows:
            <DataGrid Name="dgPayment" Margin="10,15,10,10" Grid.Column="0" AutoGenerateColumns="False"
                      IsReadOnly="False" CanUserAddRows="True" CanUserDeleteRows="True" >
                    <DataGridTextColumn Header="Seq" Binding="{Binding Path=CL_Seq}" />
                    <DataGridTextColumn Header="Name" Binding="{Binding Path=CL_Name}" Width="200" />
                    <DataGridTextColumn Header="Hdr1" Binding="{Binding Path=CL_Hdr1}" />
                    <DataGridTextColumn Header="Hdr2" Binding="{Binding Path=CL_Hdr2}" />
                    <DataGridTextColumn Header="Hdr3" Binding="{Binding Path=CL_Hdr3}" />

I have code behind as follows:
            Using conn = CashConnection
In oracle have a stored procedure return a clob and in assign the clob to a devexpress richtextbox's rtftext property
New benefit for Premium Members - Upgrade now!
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Hello all. I have an ASP.NET web forms application that has been working fine until a recent change from cookies to session variables (don't think that has anything to do with it but ...) and an upgrade of the Telerik controls.
The same code behind, in two separate ASPX pages (print and reprint), behave differently. They both use this format:

1 Dim PrintCmd as String = "PrintForm.aspx?var1=value&var2=value..."
2 PrintCmd =  "<script language=javascript> {'" & PrintCmd & "', '_blank');}</script>"
3 WriteNlog.Info(PrintCmd)
4 Response.Write(PrintCmd)
5 Response.Write(PrintCmd.Replace("Some Text","Other Text")
6 CallNlog.Info("Returned from print")

The page being called is a simple ASPX that copies the query values to labels and then the body performs window.print() then window.close(). It makes an NLog entry at preload and load, when it works.

Page1.aspx executes 1,2,3 and 6. Logging in the PrintForm.aspx does not occur, no error is reported, as if 4 and 5 are comments.
Page2.aspx executes 1 through 6 without fail.

Both origination forms use the same site master with Telerik controls (RadScriptManager, RadMenu, RadAjaxLoadingPanel and RadAjaxManager).
The print page is pure ASP webform.

Alternately I have tried:
4 ClientScript.RegisterStartupScript(Me.GetType(), "receipt1", PrintCmd, True)
5 ClientScript.RegisterStartupScript(Me.GetType(), "receipt2", PrintCmd.Replace("Some Text","Other Text"), True)

Again, page2 works flawlessly and …
I want to store HTML code in database.
is it possible? If yes then how?
Everything was going well... playing around with Visual Studio 2017 for the first time...

Had a weird problem (#1, but not really what the question is about where even though I set the Assembly Name and Root Namespace names, ApplicationName was still returning "WindowsApp1" when referenced... so I thought maybe it's building using that temp name when run from VS IDE.  So I compiled it into an app and deployed it.  Same result...

So I try re-opening the project - I can't open forms!  I can a new form, but when I try to open the main form, the only "main" reference I have is main.vb.  And when I open that, I don't have any code either!  I have one other form in the app and I can't open that either (but the code is visible).

I'd really like to continue this project but I need to see the forms!  HELP PLEASE!?!

(Classic Windows Forms app).
Hi all, I need to start an aspx page with a modal window if a codebehind query condition is true,
how to achive that dear experts!!!
How can i highlight the cell border when clicked on it.

I am using 2015 desktop.

I'm using Visual Basic in a Windows forms .net framework 4.0 application.

On load of my window I set a variable to the default value of this:

Dim TestVariable1 = "A"

I have a button called Button1 on my page.

I want to have the button toggle the value of my variable between 3 different values.

So if I click the button once then my variable is set to the following:

  TestVariable1 = "B"

If I click on the button a second time then my variable is set to the following:

  TestVariable1 = "C"

Then if I click the button a 3rd  time then my variable is set back to the following and the sequence starts over again:

  TestVariable1 = "A"

So then to summarize, on each button click , the button will rotate the value of my variable between "A", "B", "C"

Any ideas of how I would set up either a Visual Basic case or if else statement for this?

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,