Passing nodeid to upload command button

Posted on 2007-08-03
Last Modified: 2010-04-23
Hey All,

I have a listbox that generates state stores.  When the user clicks on the stores it gets the nodeid by this code.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim connectionString As String = _
"Data Source=WHSQL2K301;Initial Catalog=WilcoIntranet;Persist Security Info=True;User ID=coldfusion;Password=coldfusion"

Dim cn As New SqlClient.SqlConnection(connectionString)
Dim da As New SqlClient.SqlDataAdapter()
da.SelectCommand = New SqlClient.SqlCommand()
With da.SelectCommand
.Connection = cn
.CommandType = CommandType.Text

'You need to change the CommandText Select Statement
' Change "NodeID" to the nodeID column name
' Change "StoreName " to the nodeID column name
' Change "StoresTable " to the name of the table in your database
.CommandText = _
"SELECT NodeID, NodeNbr FROM Node ORDER BY NodeName"
End With

Me.ListBox1.DisplayMember = "NodeName"
Me.ListBox1.ValueMember = "NodeID"
End Sub

This is the problem Dim destinationFolder As String = "\\fileserver1\wilcointranet\marketingpromotion\st<nodeid>"

I need something there that will put a wildcard in the st<nodeid> so it will know what nodeid to go to from the listbox we made. If I put it in above it says "illegal characters" because of the <nodeid>

Here is that code.

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim destinationFolder As String = "\\fileserver1\wilcointranet\marketingpromotion\"

Dim files As String() = Me.TextBox5.Text.Split(vbCrLf)
For Each file As String In files
'Remove unwanted character
file = file.Replace(Chr(10), "")

If file.Trim() <> "" Then
'copy file
My.Computer.FileSystem.CopyFile(file, _
IO.Path.Combine(destinationFolder, IO.Path.GetFileName(file)), _
End If

End Sub

Question by:edfreels
    LVL 16

    Accepted Solution

    Try this:

    Dim destinationFolder As String = String.Format("\\fileserver1\wilcointranet\marketingpromotion\{0}", ListBox1.SelectedValue)
    LVL 1

    Author Comment

    YOU ARE THE BEST!!!! Worked like a charm man, thanks a TON.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now