|
Then you're looking for the File class and it's Shared .Copy() method. All you need to supply are the source filepaths and the destination.
File.Copy(sourceFilePath, destinationFilePath)
Getting to filepaths on are remote machine requires specifying the path in UNC format (\\server\share\filepath), or by drive letter paths (F:\, G:\, ...), if you have a drive mapping to the server share.
File.Copy("\\myServer\MyShare\Folder\Folder\File.txt", "C:\Folder\File.txt")RageInTheMachine9532<font size="-1">
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome</font>
|
|
|
|
|
Hi,
It Really works fine. thanx a lot for your valuable guidance. it really solves my problem. but could please tell me how to copy/download files from ftp.
the problem is i've a ftp(say ftp.xxx.com). i know the host name and ftp port id, username and password but i don't know the ip address. all i need is i want to copy the files from ftp to a machine say yy. i'm using ftp component but please anyone tell me how to use it in a proper way to solve my problem.
thanx,
Prasant
|
|
|
|
|
Prasant_Panda wrote: i'm using ftp component but please anyone tell me how to use it in a proper way to solve my problem
What/Who's FTP component? Without knowing this, it's hard to give you any kind of accurate instructions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
As per your instruction i'm giving you details. i've downloaded one ftp component for vb.net from codeguru.com. and i'm writing codes as follows.
Imports FTP
'Code In The Button click event
Dim NewFtp as Ftp.clsftp
NewFtp = New clsFTP
NewFtp.RemoteHost = "ftp.xxxxx.xxx"
NewFtp.RemotePort = xx
NewFtp.RemoteUser = "xxxx"
NewFtp.RemotePassword = "xxxx"
NewFtp.Login()
The problem is when i run this program it gives me error "no such host is known".
kindly suggest any solution for it.
thanx,
Prasant
|
|
|
|
|
It's telling you that either the host name you gave it doesn't exist or it's not responding on the port number yuo gave it. By default, FTP works on port 21. I'm not familiar with that component, so it might be that it requires the host name be in a specific format also. You'll have to check with any documentation that come with the component.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
VB.Net/MS Access. I need to insert records into a particular table (say X)after getting the data from two different tables (say A & B) and doing some permutations and combinations on it. I am getting entire data from tables A & B into two different Datasets. A loop has been written to parse the records from A (dataset), check in B(dataset) and insert the record in table C. However, this entire process is taking a long time. (i.e: in my test run, to insert around 8 lakh records, it took approx 4 hrs).
As per my perception, the time delay is being caused since I am firing an insert statement directly on the database during every loop cycle. Is there a way to avoid this and speed up the process. (i.e. Can the records be inserted into a dataset and then all the records be directly inserted into the table from the dataset)
I am providing sample code for your reference.
Code :
----------------------------------------------------------------------------
str = "select id, code, name, period from EMP2000"
ipcon.Open()
DA = New OleDbDataAdapter(str, ipcon)
DS = New DataSet
DA.Fill(DS, "irec")
str2 = "select id, code, addr, period from EMPADDR"
DA2 = New OleDbDataAdapter(str2, ipcon)
DS2 = New DataSet
DA2.Fill(DS2, "imsctrl")
DV = New DataView(DS2.Tables("imsctrl"))
str3 = "select Id, code, name, addr from EMPDATA where period = '2000'"
DA3 = New OleDbDataAdapter(str3, ipcon)
DS3 = New DataSet
DA3.Fill(DS3, "emp")
Dim cb As New OleDbCommandBuilder(DA3)
Dim cnt As Integer
cnt = 0
'''
Dim DataRow As DataRow
For Each myrow In DS.Tables("irec").Rows
If (myrow(1).Equals(System.DBNull.Value)) Then
code1 = ""
Else
code1 = myrow(1)
End If
If (myrow(3).Equals(System.DBNull.Value)) Then
period1 = ""
Else
period1 = myrow(3)
End If
If (myrow(2).Equals(System.DBNull.Value)) Then
name1 = ""
Else
name1 = myrow(2)
End If
For Each DataRow In DV.Table.Rows
If Trim(DataRow(1)) = Trim(code1) And Trim(DataRow(3)) = Trim(period1) Then
addr1 = Trim(DataRow(2))
Exit For
End If
Next
dsNewRow = DS3.Tables("emp").NewRow
dsNewRow.Item("code") = Trim(code1)
dsNewRow.Item("name") = trim(name1)
dsNewRow.Item("addr") = Trim(addr1)
DS3.Tables("emp").Rows.Add(dsNewRow)
DA3.Update(DS3, "emp")
Next
----------------------------------------------------------------------------
Is there a way to insert all the records in a dataset and finally update the dataset to the database? If there is such a way then is it really fast. Thnx for your help.
With Best Regards,
Mayur
|
|
|
|
|
This is all something that wound be MUCH faster and better done in the database itself using straight SQL code. This would require completely rewriting this.
For example,
For Each DataRow In DV.Table.Rows
If Trim(DataRow(1)) = Trim(code1) And Trim(DataRow(3)) = Trim(period1) Then
addr1 = Trim(DataRow(2))
Exit For
End If
you're going through each record in a table and looking for records that has 2 fields that match certain requirements and returning that one record. This can be done in a simple SELECT statement:
SELECT addr1 FROM irec WHERE code1=something AND period1=something
This, of course, won't run because I have no idea what your database structure is, but it'll be FAR, FAR faster than you going through each record in a table and comparing things yourself.
You code is just using a database engine for storing data. It's not using the database engine to do any processing! Your code is taking hours to run because you're not using easier and faster methods to process your data. The more you can do in SQL code, the faster this process will go!
This is what I mean by competely scrapping what you have, rethinking your logic, and breaking each step of your logic down to simpler steps. Then you can find faster ways of doing each step. I bet you could do this entire thing in a single stored procedure on an SQL server and it would probably take all of 10 seconds to run (depending on the number of records of course!) To bad Access doesn't support true stored procedures!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thnx for your reply Dave. However, my backend is MS Access. I have no idea how we can write a stored procedure in access. Is there a way to add all the new records in a dataset and then finally uploading the dataset into a table?
With Best Regards,
Mayur
|
|
|
|
|
Access doesn't support true stored procedures, so you'll have to write more efficiently in single SELECT statements. Access only supports single statement queries.
Doing it in code the way you are now is just so inefficient it's not funny. You're not using the power of the database at all. Like I said, you'll haev to rewrite this so you're code is not going through the same records time and time again "looking" for a record that matches a certain criteria. This is one MAJOR spot where your code is bogging down. Rewrite just this little search as a SELECT statement and you should see a huge imporovement.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a bookmark named "a" just a location, not a range of charater.
Suppose the word application, active document be "oDoc"
How can I set a range start from: bookmark "a"
and end at the 6 charaters after bookmark "a".
I would like to use range.text to get the value.
Thank you.
|
|
|
|
|
i want to develop a application like word processor and excel spreadsheet using vb.net. i need a proper guidance to develop this project. this is my first time in system programming. please guide me in proper manner.
thank u
s
|
|
|
|
|
rahul_760875 wrote: i want to develop a application like word processor and excel spreadsheet using vb.net.
Do you mean that you want to re-invent Word and Excel, or simply use their application interface to programatically automate their functions?
If the latter, I strongly recommend Visual Studio Tools for Office - available from MSDN. This greatly improves the 'programming experience' whilst working with Office applications.
If the former, then I'm afraid this is not the forum in which to ask that question. In fact I think you'll be wasting your time and energy since there are already viable alternatives to Microsoft Office (see OpenOffice.org[^] for an open source variant).
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
error msg Name 'CommandBehavior' is not declared.
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
how can i solve it..
|
|
|
|
|
I think it's quite obvious. You don't have an object, or other type, declared with the name CommandBehavior . Perhaps you're missing an Imports System.Data line at the top of your code?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
pandapatin wrote: how can i solve it..
For a start you could try looking up the error in the Visual Studio help. Saves a lot of time and energy - and doesn't clog the forum with unecessary posts.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
i have a custom TTS in dll form,
if i want to implement MS SAPI interface, so my custom TTS have the same interface with MS SAPI, what should i do?
thx...
|
|
|
|
|
What? Are you asking how to make your custom Text-To-Speech engine expose the same interface as Microsoft's Speech Api? Are you asking how you can replace MS's TTS Engine? Or what?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry before if my question is confusing...
What i want to ask if, how to make my custom TTS engine expose the same interface as MS SAPI? The problem is i have my custom TTS in dll form, so i cannot change the way it behave. What i want to do is to wrap my custom TTS in another dll maybe, so it has the same interface as MS SAPI. And i think the way to do it is to implement MS SAPI interface, but i don't know how? Is it clear enough? Thanks...
|
|
|
|
|
This is going to be a nightmare! You DO NOT want to replace the engine! This will create such a huge mess it's not worth it. You'd have to replace the registration of all the engine methods and properties exposed to COM with your own. This means duplicating GUID's and names, but pointing the GUID's to your COM server. Good Luck! There's hundreds(!) of them.
You'd have to implement everything exposed by the MS SAPI classes, providing the same functionality that clients using the MS library would expect.
You'd be much better off just completing your own library and not trying to "shoe horn" your implementation into MS's. Your library can run side-by-side with MS's.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is it that hard? Can't i implement just several methods like speak, stop etc?
All i want to do is, if people want to use my TTS then they can use it the same way as they use MS SAPI, with several exception of course.
|
|
|
|
|
No, there is NOTHING simple about this. You would have to change the registration keys and values of the methods and properties you're replacing and point them to your engine code (hopefully written to be exposed to COM).
You're MUCH better off just finishing your implementation and seperating yours from Microsoft's entirely. This way, your library is at least supportable and has no dependancies on other peoples/company's code. MS's library can change without notice and render your library completely useless in an instant.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have created the folowing functin from my form to call a class in another project within the same solution.
this line (sections.GetRiskSections()) is underlined and the error is:
Error 1 Value of type 'RSCompDB.Premiums.RiskSectionsList' cannot be converted to '1-dimensional array of RSCompDB.Premiums.RiskSectionsList'.
Thanks
Public Function GetRiskSections() As RSCompDB.Premiums.RiskSectionsList()
Try
Dim sections As New RSCompDB.Premiums.clsPremiums()
''''ERROR''''''''''''
Return sections.GetRiskSections()
''''ERROR'''''''
Catch ex As Exception
Throw
End Try
End Function
|
|
|
|
|
|
|
It is simple! Tabcontrol has a selectedIndex change event that is where you can control the index as stated below:
Dim GetIndex as Int32 = Nothing
Dim SetIndex as Int32 = Index numger goes here
GetIndex = Tabcontrol1.SelectedIndex
or you can set it to
Tabcontrol1.SelectedIndex = SetIndex
|
|
|
|