Link to home
Start Free TrialLog in
Avatar of edfreels
edfreelsFlag for United States of America

asked on

Passing nodeid to upload command button

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)), _
True)
End If

Next
MsgBox("done")
End Sub

Thanks
ASKER CERTIFIED SOLUTION
Avatar of TSmooth
TSmooth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edfreels

ASKER

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