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,

Hi,

Convert a format of string from fromat MM-dd-yyyy to dd-MM-yyyy

Thanks
1
I have an Excel add-in firing an HRESULT 0x800401A8 error, when calling the getter of Worksheet.Parent.

I would be glad if anyone could let me know what the error might be, but more importantly and more generally, I would like to know how I can understand these HResult codes?

I did the following but am still confused:

Read the Microsoft's documentation on the Structure of COM error Codes.
Checked this SO thread.
Tried my chances with Magnum DB.

Thanks!
0
Hi

I am working on an application to access data via API using VB.NET.

I have so far managed to request for and retrieve a security token in the format as shown below:

{"success":true,"token":"eyJhbGciOiJIUzI1NiIsImNhbGciOiJERUYifQ.eNqqVkpOyc9NzMxTslLKTcxJrCzOTDRU0lFKrShQsjI0tTACYjNT01oAAAAA__8.ElaYAGRsAV43lh2OyQ4eR1wF4UIKl7tpHS7YFamVGD8"}

I need to retrieve the "token" value and use that to access the server and request specific information.

I have created a class


Public Class SecurityToken

    <JsonProperty("success")>
    Public Property Success As String

    <JsonProperty("token")>
    Public Property Token As String()

End Class

And in my code, I successfully get to this point where I get the result as shown above


Dim dataStream As Stream = response.GetResponseStream()
Dim reader As StreamReader = New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()

I am stuck at this point in trying to split the result and retrieve just the token to use in further processing.

Any help would be appreciate.

Thank you.
0
Experts,

I have a project to convert 1000's of tif images to pdf. In order speed up the process i'm trying to use a thread pool.

The code below loops through all the directories/files but only converts a few hundred files (no errors).

I think the issue is how I have implement the threading. Can you enlighten me on the correct threading method?

Imports System.IO
Imports System.Threading
Imports GdPicture14

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ' Get recursive List of all files starting in this directory.
        Dim tifFiles As New List(Of String)
        Dim folderStack As New Stack(Of String)
        Dim fileStack As New Stack(Of String)
        Dim currFile As String = ""
        Dim Count = 0
        Dim w As WaitCallback = New WaitCallback(AddressOf cvt1)
        folderStack.Push("C:\testfolder")
        Do While (folderStack.Count > 0)
            ' Get top directory string
            Dim dir As String = folderStack.Pop
            Try
                ' Add all immediate file paths
                If Not Directory.Exists(dir.Replace("C:\", "D:\")) Then
                    Directory.CreateDirectory(dir.Replace("C:\", "D:\"))
                End If
                For Each file In Directory.GetFiles(dir, "*.tif")
                    fileStack.Push(file)
                Next
                Do While (fileStack.Count > 0)
                    currFile = …
0
On a Datagridview when I select NEW field I want it to populate the name in the grid from a text box above on the same page.
0
I'm trying to use the latest release of Microsoft Visual Basic to play a WAV file.  I want to loop the audio.  Is there a way to do this without a noticeable gap?  Is there a library available that can do this?
0
Hello, all.

I have these two commands

Example insert

{Something here} {{Something else here}}

Open in new window


Dim Regex2 As Regex = New Regex("\{.*?\}")
Dim Regex4 As Regex = New Regex("\{{.*?\}}")

Open in new window


They do not produce any errors, however.
The single { }
Will insert into the database for the {{ }}
In the database, you will see
{Something here}

Open in new window

With the curly brackets around it.

How can I distinguish between the two commands, so that only the double curly's will insert into its column, and the single curly will only insert into its column?

Thanks
Wayne
0
I am brand spanking new to ASP.NET MVC and I'm working through a tutorial to get the basics. The tutorial is in C# and I'm converting it to VB to stay consistent with some related projects. I have to assume that I'm missing something in that conversion but can't figure out what it could be.

I have the following class:

Public Class GuestResponse
    Public Name As String
    Public Email As String
    Public Phone As String
    Public WillAttend As Boolean?
End Class

Open in new window


and a strongly-typed view related to that class:

@ModelType PartyInvites.GuestResponse

@Code
    Layout = Nothing
End Code

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>RsvpForm</title>
</head>
<body>
    @Using Html.BeginForm
        @<p>Your name: @Html.TextBoxFor(Of String)(Function(x) x.Name)</p>
        @<p>Your email: @Html.TextBoxFor(Of String)(Function(x) x.Email)</p>
        @<p>Your phone: @Html.TextBoxFor(Of String)(Function(x) x.Phone)</p>
        @<p>
            Will you attend?
            @Html.DropDownListFor(Of Boolean?)(Function(x) x.WillAttend,
                                                        New SelectListItem() {New SelectListItem With {.Text = "Yes, I'll be there", .Value = Boolean.TrueString},
                                                        New SelectListItem With {.Text = "No, I can't come", .Value = Boolean.FalseString}}, "Choose an option")
        </p>
        @<input type="submit" value="Submit RSVP" />
    End Using
</body>
</html>

Open in new window


My controller has a simple action method that takes that class and responds with another view:

<HttpPost>
Function RsvpForm(g As GuestResponse) As ViewResult
    'TODO: Email response to the party organizer
    Return View("Thanks", g)
End Function

Open in new window


Unfortunately, the form data from the post request isn't being populated in my GuestResponse class. If I insert a breakpoint in that action method, all the GuestResponse properties are empty. At the same time, the Request.Form values look as expected - they're just not filling in the GuestResponse object.

I'm sure it's something small I'm missing. Any help is appreciated.
0
I have an application in VB.Net using a connection via ADODB.connection.  We are in the process of moving our "stuff to the cloud".  The new server is Server 2016 and the database is SQL Server 2008 Express.  I have enabled the protocols in SQL Server for Named Pipes, TCPIP.  It appears that I have the Server/Database/User/Pwd info correct, but the connection object is not supported?

The connection string is similar to this:
"Driver={SQL Server};Server=SQL1\SQLEXPRESS;Database=Orders;UID=sa;pwd=Adg991!; providerName=System.Data.SqlClient"

Thanks for you help!
0
I have an interesting situation. I have a URL that returns data based on a 'search' parameter within the URL.. example: dvd_search.php?type=title&search='SomeData'

The Website has different areas that can be searched. Each are is accessed by 'clicking' a button (link) that takes you to that particular Page. From there you can query for data that is related to that Page/category.

The interesting part of this that the actual resulting URL looks the same no matter which page you are on... except it will only return data that is apropos to the page you are on.

I am trying to automate the Query process from within a VB.Net program and I am trying to use CURL to get the data into a file that I can parse.

I am not at all versed in the  use of CURL but I do know that this can probably be dome in CURL if I could figure out the proper syntax that would perform the desired function..

I am guessing here but I am assuming that the key to making this work is the 'Cookie' that is being generated, probably indicates which page 'I' am on and which 'Data Set' to use.

Any help is greatly appreitated.

Thanks in advance
Rick
0
C# code converted to VB. The problem is List.SelectedItems or, rather, my lack of understanding. The exception is:

Object reference not set to an instance of an object.

Public Function CommaDelimitedString _
    (
        ByRef List As ListBox
    ) As String

         Dim returnString as string

            For Each ListBoxItem In List.SelectedItems
                Dim DataRowView As Object = Nothing
                Dim drwItem As Object = Nothing

                If drwItem Is DataRowView Then 'Check Then If the Then item can be cast To your Class
                       ' build string
                End If
            Next
  return returnString

I'm drawing a blanks on this. What am I missing? Thanks for any help.
0
original error causing showing upHello,

A strange problem popped up on Visual Studio 2019 today.  Both Projects were created recently in VS2019 vb.net

1) Project A built and working no problem on my machine and everyone else's machines.  It includes a reportview v 15.0.
2) Project B needed a new report made but I wanted to make it a local report (populated with data that was already queried and brought down from the server and residing in a dataset).  I couldn't remember how to do this so I was fiddling with some of the settings in VS 2019 for THAT project and THAT report.  So I thought...

3) When I return to Project A I get a "required privilege is not held by the client" error when executing the reportviewer1.refresh command.  Everything else in the program seems to be working fine.  Earlier versions of Project A produce the same error BUT ONLY ON MY COMPUTER.  Everybody elses works just fine.  I broke something somewhere but I have no idea where to start looking.

Any ideas are welcome.  I've already flushed out the bin, reset VS settings, Reloaded the reportviewer references, and now the project won't build at all.  Got worse as I tried to fix it....

Thanks
0
Hi Experts,

I'm trying to build in some error handling to tie the script below together and am stuck, any help with this is appreciated.

Issue:  for any computers that are offline, I'm getting RPC unabilable errors and these continue to process through the loop

Here is what I'm trying to accomplish:

1.  For error handling, is there a way to have a function determine whether the computer is up or not >  then return $true or $false and put into a condition for if.  If it's not up, is there a way to pause until it responds or break out of the loop for just that computer?  If it's up, then do patching/install functions in the workflow.

2.  In the process-monitor function (6) - I wanted to log into the .csv if this was online or offline.

3. I wanted to incorporate a function that checks for any missing or pending updates to determine if the workflow needs to be processed. (I left (2) empty for this), not sure how to accomplish this and then condition.  Here are the queries:

get-wmiobject -query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = 0" -namespace "ROOT\ccm\ClientSDK"  #which updates are missing:

Open in new window


(get-wmiobject -query "SELECT * FROM CCM_SoftwareUpdate" -namespace "ROOT\ccm\ClientSDK").name  #show needed updates

Open in new window


-Then if the above are true, trigger all, which I have in (5):

([wmiclass]'ROOT\ccm\ClientSDK:CCM_SoftwareUpdatesManager').InstallUpdates([System.Management.ManagementObject[]] (get-wmiobject -query 'SELECT * FROM CCM_SoftwareUpdate' -namespace 'ROOT\ccm\ClientSDK'))

Open in new window


Here is what the script does, I've numbered all functions in order:
1 - Test-Connection
2 - detect missing/pending
3 - detect pending reboot
4 - run advert
5 - invoke all updates
6 - process monitor
6a - call from within process monitor function to send email

Thanks!


Open in new window

0
Hey Folks

Quite stuck here.

I have a VS VB WinForms App.
I have added a datagrid and got data pulling from my SQL server etc...

It is bound as I understand it bc of this. I have loaded via design and programatically exploring all of the options.

Right now I have a LOAD button so going programatically.

However, for the life of me I cannot get any new data entered directly into the Grid to save and reload.

I have tried numerous things, so please advise what SHOULD work. Incase in my mucking about I have incorrect set something etc...

Many thanks in advance

R
0
WRiting code in visual studio vb to declare a variable that will store the cost of bananas per pound
0
Do u know any way to develop something like DocuSign? Especially we can drag and drop for signature request ?
0
I have a vb.net windows form that uses filters on the on [bindingsource]
I am trying to get a search criteria that is found anywhere in a string to return in the filter results.
[exisiting code] Master_ContactsBindingSource.Filter = "c_company = '" & InStr(CompanySearch.Text, 1) & "'"

The problem is that I receive no results (and does not error either) for terms that I know are in the table such as "son".

The desired result is to return all records that contain the search term "son" but clearly I have this wrong.

c_company = [table field]
[CompanySearch.text] is the textbox with the search term

Thoughts?
0
Hello Experts,
My app reads a text file
and inside this text file, data can have special characters like á  é  í ó ú ñ Ñ

When visual basic reads this file, these special characters are interpreted as a black character.
How can I fix this?

Here is the piece of code I am using.
        Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(filename)
            MyReader.TextFieldType = FileIO.FieldType.Delimited
            MyReader.SetDelimiters(",")

            While Not MyReader.EndOfData
                Try
                    For a = 1 To 15
                        currentRow = MyReader.ReadFields()
                        For Each currentField In currentRow
                            D1(a) = currentField
                        Next
                    Next a
                Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                    MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                End Try
                Exit While
            End While
        End Using
0
Hello All;

I have been using the ID3v2 component, ID3TagLibrary, to read the metadata of MP3 files uploaded to my server for a few years now.
And I just found out it will not keep the text format. Example.
It will take this
Dvořák
And change it to
DvoYk

I need a component that will NOT mess up the formatting of the text.
Any and all ideas will be greatly welcomed.

Thank you.
Wayne
0
I upgraded a local Access table to a remote SQL 2017 database.
1. The connection reads data but
2. The connection won't write data.
If I use the same User and Password I can change (update) data within the SMS

I use a vb.net front end and all was working great with MS Access locally

I use a SAVE button after making some data changes and I receive an error 5 which I have not been able to resolve. I've pasted the code behind the SAVE button below.

Me.Validate()
        Me.Master_ContactsBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.HVACRedu_MasterDataSet)
        Me.Master_ContactsTableAdapter.Fill(Me.HVACRedu_MasterDataSet.Master_Contacts)
        'Master_ContactsBindingSource.Filter = "email = '" & mTempEmail & "'"
        Me.Cursor = System.Windows.Forms.Cursors.Default

Here is the connection string (READ=great, write = NO
Provider=SQLNCLI10.1;Data Source=65.175.68.37;Initial Catalog=Data_Warehouse;User ID=dw_admin;Password=***

Ideas???

Thank you,
Scott
0
Hello All;

As the title suggests, I have just installed SQL Server 2019 on my test system, in hopes that I can get it to accept the Case-insensitive and accent-sensitive characters like the example below.

Dvořák Hall

So far, when I insert these characters, I get a BIG Y from the >> řá <<

Table column information

The column is set to ( CHAR )
Collation = Latin1_General_100_BIN2_UTF8

In my web.config file, I have the following.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
	<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Open in new window


Any additional information would be wonderful.
0
Hi Experts,

How can I use vb.net to access information about installed applications based on the information displayed in Control Panel / Programs and Features?

Here's a screendump showing the Name, Version and Location fields that I am after:

information about installed applications based on Control Panel / Programs and Features

Regards,
Leigh
0
I have the following loop that I want to continue until every line in SR (StreamReader) has been read and outputted. What condition should I add to the Do While Loop to have it read all the lines?

        Do While (strLine ???)            
            strLine = SR.ReadLine                               '// Read in line
            If strLine Is Nothing Then
                MessageBox.Show("Unable to extra data, please try again. If it continues to fail, please contact Brian L.")
                Exit Sub
            End If
            '// Output line when it contains useful info
            If strLine.Contains("Gi") Then
                OutputTextBox.AppendText(strLine)
                OutputTextBox.AppendText(vbCrLf)
            End If
        Loop

Open in new window

0
I need to get the value of a combobox when the user is selecting a new value.  I want the original value and what it was changed to.

I've been researching but have not found a solution.

Any ideas?
0
Hi experts,
I have wrote the C# API programe to get data from different location.
All used to work fine.Suddenly it's generating error becuase the records not available
in the API records.(requesting records)There is no way to find Candidate avaiable or not.

see below link how the API request send.

https://test/v3/company/18f62e940d1d01/position/771b0f2aff3c01/candidate/05ea659e456a01/stream

Error:

 500 Internal Server Error
{
    "error": {
        "type": "getStreamError",
        "message": "there was an unknown error getting candidate stream."
    }
}

 string urlCandatestream = "/company/" + CompanyID + "/position/" + positionID + "/candidate/" + candidateID + "/stream";
                var request = new RestRequest(urlCandatestream, Method.GET);


                request.AddHeader("Content-Type", "application/json");
                request.AddHeader("cache-control", "no-cache");
                request.AddHeader("authorization", connectAPI.getAccessToken());
                // rqst.Proxy = GlobalProxySelection.GetEmptyWebProxy();

                IRestResponse response;
                varRequest = request.ToString();
                try
                {
                    response = await _restClent.ExecuteTaskAsync(request);
                    VarRequestResults = response.Content;
                }
                catch (Exception ex)
                {
                    throw new Exception("Error executing  request to " + 

Open in new window

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,