|
You're not very specific about what your having a problem with.
Yes you can copy files and directories. All the ListBox will give you, though, is a list of filenames. It will NOT copy the files for you. For this, you'll have to use the File and Directory classes in the System.IO namespace.
Or are you having a problem with how to let your users specify where to copy the files/directories to?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim filename As String
Dim newfilepath As String = "c:\data\"
If Not Directory.Exists(newfilepath) Then
Directory.CreateDirectory(newfilepath)
End If
For i = 0 To ListBox1.SelectedItems.Count - 1
filename = Path.GetFileName(ListBox1.SelectedItems(i).ToString)
newfilepath = newfilepath & filename
FileCopy(ListBox1.SelectedItems(i).ToString, newfilepath)
Next
End Sub
|
|
|
|
|
The textbox on my form does not update the underlying database table.
I created a form with a textbox, a datagrid, and a save button. Using the wizard I created a connection to an Access database, a dataadapter, and dataset.
Then I set the datagrid up to read data from the table and the button to update those changes. That all works fine.
For the textbox I set the text databinding to a field in the database and it does display the correct information. But, if I change the textbox value and execute the dataadapter update the changes do not take. Also, the HasChanges property is false even though I changed the value. How can I get the new textbox value to write back to the table? Thanks for any help!
|
|
|
|
|
This is the code that I got a couple of days from these forums. I have 24 textboxes that this needs to go to. Is there an easier way to get them all in one function/sub or do I have to have 24 different subs?
Private Sub txtBDrain_KeyPress(KeyAscii As Integer)
KeyAscii = LimitTextInput(KeyAscii)
End Sub
Function LimitTextInput(KeyAscii) As Integer
If ((KeyAscii < Asc("0")) Or KeyAscii > Asc("9")) _
And (KeyAscii <> 8) And (KeyAscii <> 13) And (KeyAscii <> 46) Then
LimitTextInput = 0
Else
LimitTextInput = KeyAscii
End If
End Function
|
|
|
|
|
In VB6, you'll have to have 24 different subs. In VB.NET, you can have one sub that handles the same event for all 24 TextBoxes.
But, in either case, since you're using so many of these numeric-only TextBoxes, you're better option would be to make your own TextBox control, inheriting from the standard TextBox and putting this code in that control. Then you can place 24 of the new textboxes on your form without having to worry about this problem.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
can someone tell me why this error occurs when clicking on the Add new record button! I have a database which i am accing this mdb from vb.net. I made everything good with data set, data adapter and connection to the db. this error occurs:
cannot create a child list for field fastMax Orders. why is this??
|
|
|
|
|
Sounds like a master-detail relationship?
How is the relationship defined?
Is the spelling correct on all column names? Need more info
Thanks,
-Len Miller
"If I had eight hours to chop down a tree, I'd spend six sharpening my axe."
-Abraham Lincoln
|
|
|
|
|
No i have 1 table only! all the names are in good format and they are linked correctly as i can see. I have the dataset dataadapter and connection good!
|
|
|
|
|
I have one question:
In Help about odbcDataAdapter.Update Method is write text:
Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.
And when is calling SELECT statement?
I need sometimes calls on my odbcDA select command, which refresh my DataSet. Update can not I call, in my Table is not change, but in Dataset I take data from RelAted Table.
Julo
Julo Jenis
|
|
|
|
|
Update doesn't call a SELECT statement. It's used for UPDATING. All three SQL statements make changes, or UPDATE, the database.
When do you call the SELECT statement? Here's a hint: How did you fill your dataset in the first place?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You need to do OdbcDataAdapter.Fill(dataset)
This will use the select command to fill the dataset
Thanks,
-Len Miller
"If I had eight hours to chop down a tree, I'd spend six sharpening my axe."
-Abraham Lincoln
|
|
|
|
|
Ok, thats clar, but... I have one DataGrid, 5 Tables and relations between Tables. When am I in 3 table, I do som changes. I 2 Table (2.Table is Parent of 3Table) I have one field, which is SUm of fileds in 3 Table. When I come to 2 Table, I need make "Refresh", t.m. SELECT. But when I use FILL, In DataGrid is 1 Table.
Calculated field I cann not use, there is som problem with "Cannot change read only property for calculated field" )
When you know something about my problem, pease help me.
Thanks, Julo
|
|
|
|
|
Hi Folks,
I am looking for a free CTL or COM Control for XML Editing to use from VB6. Binary is okay - source might be nice.
Thanks
Davy
My Personal Blog - Homepage
|
|
|
|
|
Hello,
this is Manoj,doing a project in a company. In my project, I want to send mail (automatically, without click on send & even not displaying the composer window)through vb.net using my microsoft outlook (or anything else if can be used) which is configured to Microsoft Exchange server named bgeexc05. I am generating password automatically for an employee once he enters his empid,that password need to be sent to his emailid (by accessing emailid from database). Below are the error message which i get by using the respective code:
I have put, "Imports System" & "Imports System.Web.Mail" & below codes Written for Click Button
I have also tried for localhost.
Code1:
Dim from As String = "manoj.jahagirdhar@abc.com"
Dim mailto As String = "manoj.jahagirdhar@abc.com"
Dim subject As String = "PWD"
Dim body As String = "UtilMailMessage001 - success"
SmtpMail.SmtpServer = "bgeexc05"
SmtpMail.Send(from, mailto, subject, body)
Error Message1:
"The transport failed to connect to the server"
Code2:
Dim email As New System.Web.Mail.MailMessage
email.To = "manoj.jahagirdar@abc.com"
email.From = "manoj.jahagirdar@abc.com"
email.Body = "MessageText"
email.Subject = "SubjectText"
email.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "bgeexc05"
System.Web.Mail.SmtpMail.Send(email)
Error Message2:
The server rejected the sender address. The server response was: 454 5.7.3 Client does not have permission to submit mail to this server
Also i get get message saying, "Cannot relay on manoj.jahagirdhar@abc.com" ..........
Kindly Help
|
|
|
|
|
Download 101 VB.NET examples from msdn.microsoft.com. There is an example for sending email. You can see what to do from there.
Sounds like either your code is way off track or there is something wrong with the settings on the machine your code is running on.
|
|
|
|
|
As far as i know the smtp server needs to be the server of your service provider that you are connected with not your exchange server. For example if your internet access was with BT your smpt server would be something like smtp.btinternet.com otherwise you could easily spam from anyones email servers.
JJ
|
|
|
|
|
Can you create a VB6 program that does multi-tasking? I have to create a Printed Circuit Board test program that concurrently tests 2 boards.
Thank you for your help in advance.
|
|
|
|
|
VB6 doesn't support multi-threading. It is possible to do, but you can't debug the code using the VB6 IDE. It'll crash the IDE when the code hits a breakpoint. Last time I searched for articles on VB6 multi-threading, I came up empty.
If you really want to do this, I suggest saving yourself the time and aggrevation and do in VB.NET or C#. At least in the .NET Framework, multi-threading is MUCH eaasier to code, debug, and support.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi ppl,
i have a database with only one table named project_name. what i want is that on the page load event the last record of this database should be displayed in a textbox on my web form. how doi do this. i'm using access as my database. please help me.
thanks and regards
manik
|
|
|
|
|
This can easily be done using an SQL statement, something like:
SELECT LAST(fieldname) AS LastProjectName FROM project_name;
This will return a single table, with one row under the column name "LastProjectName".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanx dave,
it works.
regards
manik nath
|
|
|
|
|
sorry to bother you again dave. but the code works fine and gets me the data on to a datagrid. only one single LastProjectName data is returned. but when i try to get the data to a dropdownlist it does not work. how do i do this. also if there is a way by which i can get the data on a datagrid to a textbox.
i mean that the datagrid displays the LastProjectName but can i get this value into a textbox.
thanx and regards
manik
|
|
|
|
|
i find active window(FindWindow) using API. but i don't know how pass string (search word) to FindWindow's textbox? when it active. i am using sendmessagebystring API but it changes caption of active windos.
Any help appreciated
Thanks in advance
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Static lHwnd As Long
Dim lCurHwnd As Long
Dim sText As String * 255
Dim caption
lCurHwnd = GetForegroundWindow
If lCurHwnd = lHwnd Then Exit Sub
lHwnd = lCurHwnd
If lHwnd <> hwnd Then
caption = Left$(sText, GetWindowText(lHwnd, ByVal sText, 255))
Call SendMessageByString(lHwnd, WM_SETTEXT, 0&, ByVal "sample")
End If
|
|
|
|
|
You sent the SETTEXT message to the window, thereby changing the window title. You need to find the window that represents the textbox in that window, then send the message to that.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please explain how to do that?
|
|
|
|