|
I think the problem is
Directory.CreateDirectory("c:\ backup")
Remove the space after "\"
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
hello
i tried by removing space but still it doesnot copy my.mdf file to backup directory
please suggest...
thank you...
|
|
|
|
|
remove space from Dim a As String = " c:\myproject\bin\debug\my.mdf"?
|
|
|
|
|
If Not IO.directory.exists("C:\Backup") Then
IO.Directory.Create("C:\Backup")
End If
Dim a As String = "C:\Myproject\bin\debug\my.mdf"
Dim d As String = "C:\Backup\my.mdf"
IO.File.Copy(a,d)
MsgBox("Backup of 'my.mdf' was succesfull.")
This should do the trick.
Motivation is the key to software development.
|
|
|
|
|
hello
i tried with code you suggested but this is not working...
there is still no copy of my.mdf file is made to Backup folder..
just folder with blank data is created in c drive...
please suggest...
|
|
|
|
|
Does C:\Myproject\bin\debug\my.mdf exist?
Does C:\Backup\my.mdf exist?
|
|
|
|
|
Just curious, are you using Vista? If so, try running your program with Administrator priviliges
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
Hello,
do you use your database in your form? You won't be able to copy a open database.
Regards: Didi
|
|
|
|
|
Hi,
Iam using VS.2008 & looking to change programmatically, from Regional language setting [control pannel] date format to dd/MM/yyyy .
Any better ideas?
Thanks Again
|
|
|
|
|
I for one certainly wouldn't want any program to change my PC's regional settings.
Why would you want to programmatically change anything in the regional settings?
Why not just change the date format in your app ?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Changing system-wide settings just to run your app is a VERY VERY VERY BAD idea.
|
|
|
|
|
Hi all,
Can I get folder full path on the computer by its name??
Thanks
|
|
|
|
|
Only if you search recursively across the machine and know for sure that there's only one folder with that name.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks for your reply
I have another question, i made .net application and I add referance to another .net dll, i want to know if there is any way to geet dll path not application path??
Thanks
|
|
|
|
|
AFAIK, because you refered to that DLL it should be in the same folder as your application. So you could easily use Application.StartUpPath .
Example:
Dim DLLFileName As String
DLLFileName = Application.StartUpPath & "\yourfile.dll"
Where "yourfile" is replaced by the name of your DLL.
Hope this helps you out,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
Thanks for help
but this solution didn't solve the problem, my .dll file is registerd as com component and i called it from vb6 modules, i want to get its physical path to read data from config file in the same path, can i get it??
Thanks
|
|
|
|
|
You could Assembly.GetExecutingAssembly, then call GetReferencedAssemblies on the result. That would give you an array of AssemblyName classes, which each have the CodeBase property. If you wanted to check whether they were COM references, you'd have to use Assembly.Load, passing the AssemblyName of the reference in question, and poke around somewhere to see if it has any COM types
Of course, all this presupposes that you're using VB.Net, not VB6. If you're using VB6, then this is irrelevant and you need help of the type nobody on a programming forum can give you
|
|
|
|
|
Not always. Depending on whether the Copy Local property is set or not, it might be referring to a path elsewhere in the file system. This is true even with COM wrappers - they could be generated, copied elsewhere, then the reference updated to that path, with Copy Local off
|
|
|
|
|
Hi,
I need to remove all buttons on my form. I use now
For n As Integer = Controls.Count - 1 To 0 Step -1
Dim c As Control = Controls(n)
If TypeOf c Is Button Then
Me.Controls.Remove(c)
End If
Next
but when I use 0 to controls.count or a for each The routine do not remove all the buttons
So the question is what is the best way to remove all buttons on a form? not all the controls on the form are buttons the OK and cancel are on a TableLayoutPanel these 2 has to stay
Thanks
modified on Tuesday, May 12, 2009 6:32 AM
|
|
|
|
|
jan212r wrote: TableLayoutPanel
There is your problem
jan212r wrote: Controls.Count
controls will only return the controls directly on the form
You'll have to use recursion and check if the current control is a parent control (groupbox / panel / tablelayoutpanel / ... )
if so call the same function and go over all the controls in that parent control
|
|
|
|
|
For Each Btn As Button In Me.Controls
Btn.Dispose()
Next
This removes all buttons directly on the form,
And:
For Each pan As Panel In Me.Controls
For Each pButton as Button in pan.Controls
pButton.Dispose()
Next
Next
Removes all buttons in the panels contained by the form.
Etc..
I think you'll get the trick
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
Thanks for the input. But this gives no awnser to the question. I have an option that works, but when I use for each it do not work. It remove about 25% of the buttons.
|
|
|
|
|
I think you haven't understood it properly: That is because those buttons are NOT directly on the form, so you'll have to iterate through each container that might contain a button and then remove it. It's as simple as that
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
Thats also the reasen why the are on a other control becourse these 2 must stay on the form, but the others 1-60 depending on the status must all been removed. But when there are 12 (+ ok and cancel) on the form there are only 3 buttons that are removed so there stay 9 + ok + cancel
Jan
|
|
|
|
|
i am trying to remove a DomainUpDown control at runtime. My coding is as follows and it gives error.
Dim UpDown As System.Windows.Forms.DomainUpDown
For Each UpDown In Me.Controls
UpDown.Dispose()
Next
What is the error and how do I correct it.
Someone please help.
|
|
|
|