Visual Basic.NET

94K

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

I've below code to SelectFolderDialog in my previous vb.net application. I'm trying to implement it to c# but didn't succeeded.

Can anyone help me to convert it to C# or any additional solution would be grateful.

Public Class SelectFolderDialog
    Implements IDisposable

    ' Wrapped dialog
    Private OFD As System.Windows.Forms.OpenFileDialog = Nothing

    ''' <summary>
    ''' Initialize our Open File Dialog object
    ''' </summary>
    Public Sub New()
        OFD = New System.Windows.Forms.OpenFileDialog()

        With OFD
            .Filter = "Folders|" & vbLf
            .AddExtension = False
            .CheckFileExists = False
            .DereferenceLinks = True
            .Multiselect = False
        End With
    End Sub

#Region "Properties"

    ''' <summary>
    ''' Gets/Sets the initial folder to be selected. A value of Nothing or Emplty selects the current directory.
    ''' </summary>
    Public Property InitialDirectory() As String
        Get
            Return OFD.InitialDirectory
        End Get
        Set(value As String)
            OFD.InitialDirectory = CType(IIf(value Is Nothing OrElse value.Length = 0, Environment.CurrentDirectory, value), String)
        End Set
    End Property

    ''' <summary>
    ''' Gets/Sets the title to show in the dialog. A value of Nothing or Empty defaults to 'Select a folder'
    ''' </summary>
    Public Property Title() As String
        Get
            Return OFD.Title
        End Get
        

Open in new window

0
Learn SQL Server Core 2016
LVL 13
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Greeting

I am working on a VB.NET application that is sending emails via Exchange Web Service. I list of recipients are query from the database attached to the email via:

strTo="jdoe@website.com; bsmith@website.com"

email.ToRecipients.Add(strTo)

The issue seems to come when one or more of the recipients is out of office and not available. When email through Outlook these things are not an issue. How can I force the exchange to send the email reguardless of whether they are available or not. I don't even care whether a have a bad email address or not, send the rest.

Error message:

At least one recipient isn't valid., Recipient "jdoe@website.com; bsmith@website.com" isn't resolved. All recipients must be resolved before a message can be submitted.Error thrown in CTBNotifications auto approval process
0
I'm tripping over how to best accomplish this:

The Goal: to extract a block of data from a text file, using a line of fixed text as the
start and end markers, for the desired data.
The technology:  vb.net (2017) forms app

Example text of file:

ZZZZ 123455
RrtGGY 4454544

                    EEERTG
22212

                   ABCD
line of data#1
line of data#2
line of data#3
line of data#4

EFGH


In the above text, I'd like to parse the file, looking for "ABCD"
If found, then grab all lines of text between that, and:
"EFGH"

I've been trying  ReadAllLines method, but keep tripping over how to get what I'm wanting..

Thanks for any help.
Rich
0
Hello,
In VB.NET  how can I get a date for the Monday in a week.
Example
Date selected is 17-09-2019 which is Tuesday , it should return 16-09-2019 which is Monday's Date
Date selected is 11-09-2019 which is Tuesday , it should return 09-09-2019 which is Monday's Date

Any suggestions?

Thanks
1
I have a windows vb.net form  application with several controls on it such as a text box control, a grid control, a button control and drop down list box control.
At any point in time the user can change the focus of the control to a different control by pressing the tab key,  or selecting another control with the mouse cursor, etc.

So is there any type of variable that keeps track of the last control which had the focus? For example if I am typing in a text box control and then select the drop down box control, how can I determine that the text box control was the last control to have focus on the form?

I know about the LostFocus event, but if there exists a flag which keeps track of the last control which had focus, I would like to know how to access that information?
0
Any one know a good example how save outlook msg into a mysql database?

im using VB.net with mysql and I would like to save the file msg as binary un mysql
0
Convert a string to date format :
dd-mm-yyyy
in vb.net

Thanks
0
I want to look at the DataGridView whether I use immediate window or the watch.  The problem is if I do something as simple as dgv.Rows.Count I get &H2 instead of a number.  How do you change this so you can see a numeric value and NOT Hex?

DataGridView
0
Hi

      I am trying to build an html button for an email where the button is wrapped in a table cell using the following code. It isn't working properly as shown in the attached image

      Dim oLinkAccept As String = "http://SteelYard.azurewebsites.net/offers_to_me?oOfferID=" & oNewOfferID & "&oOfferAcceptDecline=Accept"

            oHBody = oHBody & TableCellWrapper("<a href=" & oLinkAccept & " style='padding: 8px 12px; border: 1px solid #006400;border-radius: 2px;font-family: Helvetica, Arial, sans - serif;font-size:   14px; color: #006400;text-decoration: none;font-weight:bold;display: inline-block;' >ACCEPT</a>")

    Function TableCellWrapper(ByVal X As String) As String

        Dim S As String

        S = "<table width = '100%' cellspacing='0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td>"
        S &= S & "<table cellspacing = '0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td style = 'border-radius: 2px;' bgcolor='#ED2939'>"
        '<a  Class=”link” href="https://www.copernica.com" target="_blank">
        'Click            
        '</a>
        S &= S & X
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"



        TableCellWrapper = S

    End Function

Image1.jpg
0
Hi

I am building the following clickable button link and it looks good and works well in most emailing systems except gmail where it just appears as a normal hyperlink with no border. Why would that be?


            Dim oLinkAccept As String = "http://SteelYard.azurewebsites.net/offers_by_me?oOfferID=" & oOfferID & "&oCounterofferAcceptDecline=Accept"

            oHBody = oHBody & "<a href=" & oLinkAccept & " style='padding: 8px 12px; border: 1px solid #006400;border-radius: 2px;font-family: Helvetica, Arial, sans - serif;font-size:   14px; color: #006400;text-decoration: none;font-weight:bold;display: inline-block;' >ACCEPT</a>"
0
Exploring SQL Server 2016: Fundamentals
LVL 13
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

I am trying to parse a return value of the date.now

I have the following:

'On a button control I have the following

Dim date1 as Date = Date.now

'I would like to parse the returned value # 9/5/2019 01:27:04 PM#

Open in new window


The format I am trying to get is the following
<min,hour,date,weekday,month,year>

So the returned value above would look like:

<27,01,05,4,9,2019>

Any help would be amazing.
0
Hi.  I am using the following hyperlink in the html of an email. I now want to include a text box
 in the email body too. I want the user to enter a value in the text box so that when my hyperlink is clicked it uses the value in the text box


  Dim oLinkAccept As String = "http://xxxx.azurewebsites.net/offers_to_me?oOfferID=" & oNewOfferID & "&oOfferAcceptDecline=Accept"

       oHBody = oHBody & "<a href=" & oLinkAccept & ">ACCEPT</a>"
0
In VB.net, Suppose I am accepting user input as a string. I need to check for a value of Zero. However it is possible that someone could enter "000000", or "000",
Which I would consider as valid because when converted to an integer, they are equivalent. 0 = 0

Without converting this input value "000000" to an integer, what would be a good way to check if the entire string contains only the character(s) "0"
0
I am working on a Windows Form Application

I have a text box control which has a LostFocus event. Is it possible to determine which key was pressed inside of this event? As you know I can determine the keypress in the _KeyPress event for the control, however it would be nice to be able to determine which key was pressed when inside of the LostFocus event.

Ex:
Private Sub TextBox1_LostFocus(sender As Object, e As System.Windows.Forms.PreviewKeyDownEventArgs)


End Sub
0
Hi.  I am using the following code to catch errors in the Xero API.The following has the ValidationException, but there are other exceptions like .APIException and .BadRequestException
How do I get the information on Exceptions if there are more than one of these types of Exception?      

Catch ex As Xero.Api.Infrastructure.Exceptions.ValidationException

            For Each v In ex.ValidationErrors
                System.Diagnostics.Debug.WriteLine(v.Message)
                oValidationErrors = oValidationErrors & " " & v.Message
            Next
            Response.Write("Error Line Details " & oValidationErrors)

        End Try
0
Hi

I have a local SQL Server database that I connect to using the following connection string in VB.net
For some reason I suddenly can't connect. Nothing has changed about the database
Server=DESKTOP-CVD5K6J;Database=VBDataSQL;User ID=VBUser;Password=4vbu;Integrated Security=true
0
Hello,
How to make a tabcontrol , tabheaders invisible.
I am using vb.net .

Thanks
0
Hello,

When trying to reference Form1 from From2 in a project compiled as class library (Testlibrary), I receive the following error message:
"Reference to a non-shared member requires an object reference"
 I tried using the name of the library and was able to link it to Form1 but the C1TrueDBGrid control (C1Screen3) is still given the same error message.

How do I fix this issue?

For Each Srow In Testlibrary.Form1.C1Screen3.SelectedRows *****Error Line***
            If vc1 > 0 Then
                '  xyzwc = xyzwc & "OR NSN LIKE " & "'%" & Me.C1Screen3.Columns("NSN").CellText(Srow) & "%'"
                xyzwc = xyzwc & "," & "'" & Form1.C1Screen3.Columns("NSN").CellText(Srow) & "'"
            Else
                ' xyzwc = "NSN LIKE '%" & Me.C1Screen3.Columns("NSN").CellText(Srow) & "%'"
                xyzwc = "'" & Form1.C1Screen3.Columns("NSN").CellText(Srow) & "'"
            End If
            vc1 = vc1 + 1
        Next

Kind regards,

Victor
0
I need to determine when the application user tabs out of a specific text box control on my  VB.net Windows form.
I am using all of the below events to try and capture when focus leaves the text box (Either by tabbing or a mouse cursor).
I noticed that the PreviewKeyDown event fires on tabbing out of the control, but it will also fire if someone simply types text into the control. So
does any expert know how to capture only when someone tabs out of the text box control?

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox1_Leave(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox1_LostFocus(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox1_PreviewKeyDown As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub
0
Starting with Angular 5
LVL 13
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Greetings

Is there a way to pass to a Crystal Report the database connection? What we are hoping there is way to pass the the report via the VB.NET application the database to connect. This way whether we are publishing our application to a Test/Q&A server or to a production server, we do no need to edit the connection in each report prior to publishing.
0
I ant to declare a variable in the following code used with an API but
I get an error showing that the variable is hidden in an encclosong blocck


If Hosting.HostingEnvironment.IsDevelopmentEnvironment Then
                Dim myxeroconsumer As New Consumer("xxx", "yyyy")
            Else
                Dim myxeroconsumer As New Consumer("gggg", "jjjjj")
            End If
0
I am doing this:

   cmbRunList.Items.Add(myreader("Run Description").ToString())


This run description is what i am shown. How do i add a hidden value to the dropdown that is not shown but i am able to use latter in the code?
0
Hi. In ASP.net what VB.net code would I use to see if the site has been published. I have to run slightly different code to what I run in debug mode.
0
I want to practice vb.net by creating a few applications.  I can't seem to find a free download that when i download contains vb.net. Where can i go to download this?
0
Hi. When I select an item in my ASP.net DropDownList I don't see the value in the variable P below
Also after the section the DropDownList text is  blank. What might cause this

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged


        Dim P As String = Me.DropDownList1.Text

    End Sub
0

Visual Basic.NET

94K

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,