|
Thanks for your answer, but are there really different objects called "FolderBrowserDialog"?
I had used the one "FolderBrowserDialog" before, like
Dim openFLD As New FolderBrowserDialog and that's the one that takes endless time and makes the application freeze with a large file number.
In case there are different objects of the same name: HOW would I tell VB which one to use?
Regards
Michael
|
|
|
|
|
I've added a binary file to my project as a resource, and set it's Build Action to Embedded Resource. How can I read the data and save it into an output file when the user clicks a button?
modified on Thursday, October 9, 2008 2:36 PM
|
|
|
|
|
Which version of .NET or Visual Studio are you using?? If using .NET 2.0 or Visual Studio 2005 or above, it's easy.
Dim fs As New FileStream(pathToFileToWrite, FileMode.Create, FileAccess.Write, FileShare.None)
fs.Write(My.Resources.resourceName, 0, My.Resources.resourceName.Length)
fs.Close()
|
|
|
|
|
Hi all...
I am getting problem while searching records in a given range of dates.
I used following codes to search a single record,
where con is connection name and date is stored in a textbox named txtdate.
dim sql as string="Select name from emp where date like '" & txtdate.text & "'"
dim cmd as new oledb.oledbcommand(sql,con)
dim reader as oledb.oledb.datareader=cmd.executereader
while reader.read
'code is here
wnd while
reader.close
This only gives records for a single date.
What should I write to get records in a given range of dates like records between dates 06/05/08 to 06/06/08
Gagan
|
|
|
|
|
Freehand, but you get the jist.
Select name from emp where date >= 'Date1Value and date <= 'date2value'
or
Select name from emp where date between 'datevalue1' and 'datevalue2'
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
Gagan.20 wrote: dim sql as string="Select name from emp where date like '" & txtdate.text & "'"
Word of advise, string concatenation in a query like this, opens you up to SQL Injection attacks.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have an app that has a reference to MS Excel 9.0. Below is a generic snippet that can be used to verify the condition.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oExcel As Excel.Application = Nothing
oExcel = New Excel.Application
oExcel.Workbooks.Open(Filename:="C:\0000.xls")
oExcel = Nothing
End Sub
The referenced file from what I can tell is EXCEL9.OLB. On my dev box 2 interop dlls are created: Interop.Excel.dll and Interop.Microsoft.Office.Core.dll (not sure what this file correlates to?) and the copy local property is true.
The app works fine on my dev box. I attempt to copy my release folder and c:\win\sys32\EXCEL9.OLB files to the same directories on a test box, along with C:\0000.xls. The application errors off with "System.Runtime.InteropServices.COMException".
Is there something I am missing to deploy an interop app that is using an office reference (specifically to version 9.0)? Thanks for any pointers - having a hard time with this.
I have also tried using TLBIMP with EXCEL9.OLB and then referencing the Excel.dll and Office.dll generated, but the same errors occur.
Additional edits:
I have Office XP installed but have the Excel9.olb file in my sys32 directory. I tried these recommendations:
Achieving Backward Compatibility with .NET Interop: Excel as Case Study
Creating an Excel Spreadsheet programmatically using VB.NET
Same problem.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
modified on Thursday, October 9, 2008 3:08 PM
|
|
|
|
|
If I install excel on the test machine, everything is fine.
Any idea what files need to be redistributed?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
The entire installation of Excel is the only licensed method. AFAIK, there is no licensed "partial" installation.
|
|
|
|
|
Roger that Dave.
Thanks!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
Hi
Does anyone know of a better quick way to copy directories/files in VB.net than using
[code]
Computer.FileSystem.CopyFile
[/code]
The reason is because I’m developing a system that copies files/directories from one or multiple location to one location, to do this I use the below function
[code]
Public Sub copyDirectory(ByVal strtoROOTlocation As String, ByVal strrootfromName As String, ByVal root As DirectoryInfo, ByVal intIndex As Integer, ByVal video As Boolean)
Dim strfromDirectoryFullPath As String = root.FullName
Dim strtoDrectoryName As String
Dim blcopy As Boolean
If intIndex = 0 Then
strtoDrectoryName = ""
Else
strtoDrectoryName = "\" + root.Name
End If
For Each fiifiles As FileInfo In root.GetFiles
If blcopy Then
'This will stop Un needed files being copied
If Not fiifiles.Extension = ".doc" And Not fiifiles.Extension = ".fla" And Not fiifiles.Extension = ".db" Then
My.Computer.FileSystem.CopyFile(strfromDirectoryFullPath + "\" + fiifiles.Name, strtoROOTlocation + "\" + strtoDrectoryName + "\" + fiifiles.Name, True)
'frmmain.build.BackgroundWorker1.ReportProgress("********" + fiifiles.Name, "full")
Else
End If
End If 'END IF (blcopy Second Level)
Next ' END Root Folder - Content Loop
Else
End If 'END IF (NO video)
For Each driirectory As DirectoryInfo In root.GetDirectories
copyDirectory(strtoROOTlocation + "\" + strtoDrectoryName, strtoROOTlocation + "\" + strtoDrectoryName, driirectory, intIndex + 1, video)
Next ' END Root Folder - Content Loop
End Sub
[/code]
This seems fine until it starts copying large files…
Does anyone know of a better way that I could increase the speed of copying large files..
Thanks
|
|
|
|
|
Your only option is to farm out the actualy copying of files to the Shell. This is as fast as it's going to get. But don't expect huge gains in performance. You can find examples here[^].
|
|
|
|
|
Had a quick look at this and it seems good, but it always ask if i want to create a directory files if there is nothing there..
Do you know quickly if there is a way of telling it not to ask and create the directory automatically?
Thanks
|
|
|
|
|
I've got over my issue by doing the below
[code]
If Not Directory.Exists(strtoROOTlocation + "\" + strtoDrectoryName) Then
Directory.CreateDirectory(strtoROOTlocation + "\" + strtoDrectoryName)
End If
ShellCopy(strfromDirectoryFullPath + "\" + fiifiles.Name, strtoROOTlocation + "\" + strtoDrectoryName + "\" + fiifiles.Name, 100)
[/code]
Thanks
|
|
|
|
|
With all the (very bad) string concantenation your doing to build paths, you may want to look into the Path.Combine[^] method to do this for you.
|
|
|
|
|
cooper000007 wrote: [code]
Do use the <code> and </code> tags instead. It makes code look nicer when posted
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi All,
I am having an assignment in which i m working on local machine and a proxy is set on Remote machine. So i need to send mail from local machine. When i m trying to open gamil from local machine then it is showing site is prohibited. for this i need to go on server machine using remote desktop to send mail using gmail a/c.
So i want to send mail from local machine. plz help me and provide me source code in vb.net.
Thanks,
Rohit
|
|
|
|
|
I'm making a few assuptions about your environment here, but, as far as your description goes, you're out of luck. The proxy is specifically prohibiting you from getting to GMail, probably for very good reasons.
You either have to have the administrators open up the Proxy to GMail, or you're not going to be using GMail.
|
|
|
|
|
Thanks for reply.
This is correct that proxy is specifically prohibiting for getting Gmail.
This Question is related to our upcoming project in which we need to send mail using local machine. Currently we are going at remote server and testing our application. Mail is going correctly on remote computer but when we are running application at local machine then it is showing "Failure Sending Mail message".
So we know that there is proxy on Remote side and we need to test it on local machine
Please give me suggestion as source code
Regards
Rohit
|
|
|
|
|
rohitkpurohit wrote: This Question is related to our upcoming project in which we need to send mail using local machine.
OK. Your "local machine" will need to be running an SMTP server to send mail out. Oh! And that box is going to need access to the internet through your firewall too. On top of that, any upstream mail servers you end up going through are going to demand your SMTP server be authorize to use them.
rohitkpurohit wrote: "Failure Sending Mail message".
This is probably because your machine cannot connect to the target server. Again, your proxy/firewall is getting the way. No amount of code you write will get around this problem. You simply have to get acces from your network administrators.
|
|
|
|
|
thanks for reply,
i will try as u told me.
|
|
|
|
|
Hello,
I have the following question.
I publish my application to a folder, after that i copy the folder to for example a usb stick with that stick i go to the PC where the programm needs to be installed.
When i run the setup the programm is auto installing and is working without any problems.
What i dont find is how i can set the directory where the programm needs to be installed . for the moment is is installing someware Locallow\...\...
So the directory is not in program files.
Can anyone tell me how i can change that ?
I have a second question, i need to copy also a DLL for my star ticketprinter to the installation destination folder is there a way that i can include it in the setup ?
Thanks
Best regards
DCA
|
|
|
|
|
Is it published using ClickOnce?? If so, you have no control over the install location.
If you created an .MSI installer (non-Express versions of VS,) then you've got control over where it installs. Or, you can even use third party installer creation apps, like InnoSetup, Wise Package Studio, InstallShield, ...
|
|
|
|
|
Hello,
Thanks for responding.
When i check the properties of the project i see in security settings Enable Clickone Security settings. When i uncheck that one and do a publish i can still not select the destination directory.
Can you please give one more time advise please.
thanks
DCA
|
|
|
|
|
I already said if you're using ClickOnce to deploy your application, and you are from what I can tell, you have zero control over the installation directory. Once again - are you using an Express Edition of Visual Studio??
It's that simple. I already told you want your options are.
|
|
|
|