|
tamila_tamila wrote: note: u can see visual basic for applications under references of tools menu
tools->references->VBA
its mandatory check , we cant uncheck it.
This would have nothing to do with a Help file being launched.
You're saying that VBA Help is launching along with YOUR help file? Is this code in an Office application?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
that is not the code , i do no why VB help help is alsp opening with my help. anything to be set in context sensitive help, actually i do no wat kind of help it is after clicking F1 in vb code
www.tamilselvan.zoomshare.com
|
|
|
|
|
I have built an application that watches a specified folder for any new/changes/deleted files. The program that keeps alist of all changes/added files in a listbox so that it knows what to move when instructed to. The reason this program was built to help my company transfer all changed files from our stage enviroment to our production enviroment for our website.
The entire program seems work, however when a file is copied, it seems to copy the "file.txt" but erases the data inside the original, as well as the new copy of it. Also the program checks to see if the "COPY" already exists, if so it makes a copy-of-the-copy, and puts that in a backup folder. It seems as thought when this process occurs, the data contained in that "COPY" is moved succesfully to the "BACKUP" folder, but the original "COPY" is then erased. showing "0kb". This is a big issues since I really dont' want this program deleteing all of our data when it try to move the files.
If someone can figure out why when I try to copy a file it erases the data, I would be very, very grateful.!!! I plan on posting this application working one in articles within the next few days.
Program Uses
File System Watcher
File Copy methods.
<br />
<br />
Imports System.IO<br />
Imports System.Diagnostics<br />
<br />
Public Class Form2<br />
' Created 2/7/2005 <br />
' Concept applications to watch stage for file changes, and keep record of list. Then moving all changed files to production<br />
' Copy all files that have changed, or have been created to new folder based on scheduled timeframe<br />
<br />
Public watchfolder As FileSystemWatcher<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_startwatch.Click<br />
watchfolder = New System.IO.FileSystemWatcher()<br />
<br />
'this is the path we want to monitor<br />
watchfolder.Path = txt_watchpath.Text<br />
<br />
'Add a list of Filter we want to specify<br />
'make sure you use OR for each Filter as we need to<br />
'all of those <br />
<br />
' Specifies that filesystemwatch will watch subdirectories<br />
watchfolder.IncludeSubdirectories = True<br />
<br />
watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName<br />
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _<br />
IO.NotifyFilters.FileName<br />
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _<br />
IO.NotifyFilters.Attributes<br />
<br />
<br />
' add the handler to each event<br />
AddHandler watchfolder.Changed, AddressOf logchange<br />
AddHandler watchfolder.Created, AddressOf logchange<br />
AddHandler watchfolder.Deleted, AddressOf logchange<br />
<br />
' add the rename handler as the signature is different<br />
AddHandler watchfolder.Renamed, AddressOf logrename<br />
<br />
'Set this property to true to start watching<br />
watchfolder.EnableRaisingEvents = True<br />
<br />
btn_startwatch.Enabled = False<br />
btn_stop.Enabled = True<br />
<br />
txt_status.Text = "Watching Folder(s) & File(s)"<br />
'End of code for btn_start_click<br />
End Sub<br />
<br />
Private Sub logchange(ByVal source As Object, ByVal e As _<br />
System.IO.FileSystemEventArgs)<br />
If e.ChangeType = IO.WatcherChangeTypes.Changed Then<br />
txt_folderactivity.Text &= "File " & e.FullPath & _<br />
" has been modified" & vbCrLf<br />
<br />
' Check to see if item is already added to the list<br />
Dim a As Integer<br />
Dim CaseSense As Integer<br />
'CaseSense = 0 For CaSe SeNsItIvE<br />
'CaseSense = 1 for not case sensitive<br />
' works with List, Combo<br />
For a = 0 To changed_files.Items.Count() - 1<br />
If InStr(1, changed_files.Items(a), e.Name, CaseSense) _<br />
And Len(changed_files.Items(a)) = Len(e.Name) Then Exit Sub<br />
Next<br />
<br />
' end if exist code<br />
<br />
changed_files.Items.Add(e.Name) ' adds the modified file to the list<br />
<br />
txt_itemcount.Text = changed_files.Items.Count() ' updates the item count on-screen<br />
<br />
End If<br />
If e.ChangeType = IO.WatcherChangeTypes.Created Then<br />
txt_folderactivity.Text &= "File " & e.FullPath & _<br />
" has been created" & vbCrLf<br />
<br />
' Check to see if item is already added to the list<br />
Dim a As Integer<br />
Dim CaseSense As Integer<br />
'CaseSense = 0 For CaSe SeNsItIvE<br />
'CaseSense = 1 for not case sensitive<br />
' works with List, Combo<br />
For a = 0 To changed_files.Items.Count() - 1<br />
If InStr(1, changed_files.Items(a), e.Name, CaseSense) _<br />
And Len(changed_files.Items(a)) = Len(e.Name) Then Exit Sub<br />
Next<br />
<br />
' end if exist code<br />
<br />
<br />
changed_files.Items.Add(e.Name) ' adds the modified file to the list<br />
<br />
txt_itemcount.Text = changed_files.Items.Count() ' updates the item count on-screen<br />
<br />
End If<br />
If e.ChangeType = IO.WatcherChangeTypes.Deleted Then<br />
txt_folderactivity.Text &= "File " & e.FullPath & _<br />
" has been deleted" & vbCrLf<br />
End If<br />
End Sub<br />
<br />
Public Sub logrename(ByVal source As Object, ByVal e As _<br />
System.IO.RenamedEventArgs)<br />
txt_folderactivity.Text &= "File" & e.OldName & _<br />
" has been renamed to " & e.Name & vbCrLf<br />
End Sub<br />
<br />
Private Sub btn_stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_stop.Click<br />
watchfolder.EnableRaisingEvents = False<br />
btn_startwatch.Enabled = True<br />
btn_stop.Enabled = False<br />
txt_status.Text = "Stopped"<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
Dim x As Integer<br />
Dim count As Integer<br />
Dim listboxitem As String<br />
count = changed_files.Items.Count() - 1<br />
<br />
If txt_watchpath.Text = "" Then<br />
Dim MsgResult As MsgBoxResult<br />
MsgResult = MsgBox("You must enter a valid (Folder to watch) path.")<br />
End If<br />
<br />
' Sets the current status of the applications (copying)<br />
txt_status.Text = "Copying Files to selected location"<br />
<br />
<br />
' Display the ProgressBar control.<br />
ProgressBar1.Visible = True<br />
' Set Minimum to 1 to represent the first file being copied.<br />
ProgressBar1.Minimum = 0<br />
' Set Maximum to the total number of files to copy.<br />
ProgressBar1.Maximum = count<br />
' Set the initial value of the ProgressBar.<br />
ProgressBar1.Value = 0<br />
' Set the Step property to a value of 1 to represent each file being copied.<br />
ProgressBar1.Step = 1<br />
<br />
<br />
<br />
<br />
For x = 0 To count<br />
<br />
changed_files.SetSelected(x, True)<br />
listboxitem = changed_files.SelectedItem.ToString()<br />
<br />
' Directories that are being manipulated.<br />
Dim path As String = txt_watchpath.Text + "\" + listboxitem ' Watch Path<br />
Dim path2 As String = txt_copyLocation.Text + "\" + listboxitem ' "Copy to" Location<br />
Dim path3 As String = txt_backupLocation.Text + "\" + listboxitem ' "Copy to (if file exists)-Backup" location<br />
<br />
Try<br />
Dim fs As FileStream = File.Create(path)<br />
fs.Close()<br />
<br />
' Ensure that the Copy locations does Not already contain the files<br />
If File.Exists(path2) Then<br />
If File.Exists(path3) Then<br />
File.Delete(path3) 'if file exists is in backup location already- delete it<br />
End If<br />
File.Copy(path2, path3) ' if copylocation file exists , move to backup folder<br />
<br />
End If<br />
File.Delete(path2)<br />
' Copy the file.<br />
File.Copy(path, path2)<br />
'Console.WriteLine("{0} copied to {1}", Path, path2)<br />
<br />
' Try to copy the same file again, which should succeed.<br />
File.Copy(path, path2, True)<br />
' Console.WriteLine("The second Copy operation succeeded, which was expected.")<br />
<br />
Catch<br />
txt_status.ForeColor.ToKnownColor.Red.ToString()<br />
txt_status.Text = "An error has occurred while copying changed/created file(s)"<br />
End Try<br />
<br />
ProgressBar1.PerformStep() ' Increment the progress bar<br />
<br />
Next x ' goes through next item in the listbox<br />
<br />
<br />
<br />
' Sets the current status of the applications (copying)<br />
txt_status.Text = "All files have been copies Succesfully!"<br />
End Sub<br />
<br />
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_brs_Folder.Click<br />
Dim folderBrowserDialog1 As New FolderBrowserDialog<br />
<br />
'Present the user with a file open dialog box.<br />
folderBrowserDialog1.ShowNewFolderButton = True<br />
If folderBrowserDialog1.ShowDialog() = DialogResult.OK Then<br />
<br />
End If<br />
txt_watchpath.Text = folderBrowserDialog1.SelectedPath<br />
End Sub<br />
<br />
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
End Sub<br />
<br />
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_brs_Copy.Click<br />
Dim folderBrowserDialog1 As New FolderBrowserDialog<br />
<br />
'Present the user with a file open dialog box.<br />
folderBrowserDialog1.ShowNewFolderButton = True<br />
If folderBrowserDialog1.ShowDialog() = DialogResult.OK Then<br />
<br />
End If<br />
txt_copyLocation.Text = folderBrowserDialog1.SelectedPath<br />
End Sub<br />
<br />
Private Sub btn_brs_Backup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_brs_Backup.Click<br />
Dim folderBrowserDialog1 As New FolderBrowserDialog<br />
<br />
'Present the user with a file open dialog box.<br />
folderBrowserDialog1.ShowNewFolderButton = True<br />
If folderBrowserDialog1.ShowDialog() = DialogResult.OK Then<br />
<br />
End If<br />
txt_backupLocation.Text = folderBrowserDialog1.SelectedPath<br />
End Sub<br />
<br />
Private Sub Button1_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
changed_files.Items.Clear()<br />
End Sub<br />
<br />
<br />
<br />
End Class<br />
<br />
Please e-mail if you have any questions or want the zip file.
erik4ever@gmail.com
|
|
|
|
|
Without spending much time on this...
This is just a guess but ..
Dim fs As FileStream = File.Create(path)
fs.Close()
Won't this create a blank file? You create the stream and close it without writing any data.
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
So what is your solution, I mean I have tried moving this to the very end of my code (right after the "END TRY") and still nothing.
Please help, been struggling with this for 2 days now.
|
|
|
|
|
I figured it out. I didn't even need the "FILE STREAM" code in there, I removed it completely, and the fs.close() and it works GREAT NOW!. Look for a post to the articles section soon with whole program.
|
|
|
|
|
Hello!
I realized that the hide function of tabcontrol is not hidding the specific tabpage. Is there a way to enable/disable or hide/show a tabpage of tabcontrol instead of adding or removing it?
I am using VS 2005 and hide function is not working out with tabpages as shown below statement.
Tabcontrol1.tabpage(2).hide() <-- It is not hiding the tabpage
Thanks!
|
|
|
|
|
No, there isn't.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
Is there any method that can be used to return form to state where it was created for the first time( clear all the text box, rebinding all the control, etc ) without closing the form itself?
Thanks and regards,
WiL
|
|
|
|
|
No, there isn't. You have to write the code to reset all of this yourself.
Your only other option is to kill the current instance of the form and create a new one.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi...
i want to know, if we have a .dll file, how do we call method inside it from VC++ 6.0?
thx...
-- modified at 4:23 Thursday 9th February, 2006
i'm sorry, hehehe... the real question is :
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...
|
|
|
|
|
Ask this in the Visual C++ Forum...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Pls help where can i download a free flexcell grid 2.0 .net
if you know some links where to download it.. it'll be a very great help....
Pls i need the link for free download for flexcell / flexgrid 2.0 .net.....
Thanks and more power
|
|
|
|
|
Google[^] is your friend. Get to know it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
in vb.net form, i have 1 text box and 1 command button
when user type in file name (no extension, just name) in the text box and click the button, it will open the file in a specific program (ex: winamp or wmp)
-click event:<br />
run winamp (or wmp) and play file with full path as "c:\data\ + file name (from text box) + .mp3"
help, please....
thanks a lot!
-- modified at 3:00 Wednesday 8th February, 2006
|
|
|
|
|
This will be a solution, if you make your application for you.
Name of the textbox is TextBox1
System.Diagnostics.Process.Start("c:\data\" & TextBox1.text & ".mp3")
You can use it, if Winamp is associated with mp3 files.
If not,
Right click on a mp3 file
Select open with.
Select Winamp from the list
Check Always use the selected program to open this kind of file
Click OK.
chatura
|
|
|
|
|
thanks, i got it done with your help.
|
|
|
|
|
i want to know the step by step process of database conectivity in vb.net
kaps
|
|
|
|
|
What type of Database?
Populate a DataTable from an Access Database:
<br />
<br />
Imports System.Data <br />
<br />
Dim cnStr As String= "Provider=Microsoft.Jet.OLEDB.4.0;" _<br />
& " Data source=C:\DatabaseName.mdb" _<br />
& "; Connect Timeout=10"<br />
Dim cn As New OleDb.OleDbConnection(cnStr)<br />
Dim strSelect as string = "SELECT * FROM MyTableName"<br />
Dim cmd As New OleDb.OleDbCommand(strSelect, cn)<br />
Dim da As New OleDb.OleDbDataAdapter(cmd)<br />
Dim dt as New DataTable<br />
Try<br />
cn.Open()<br />
da.FillSchema(dt, SchemaType.Source)<br />
da.Fill(dt)<br />
Catch ex As Exception<br />
Messagebox.Show(ex.Message)<br />
Finally<br />
cn.Close()<br />
End Try
Populate a DataTable from an MS-SQL Database:
<br />
Imports System.Data <br />
<br />
Dim cnStr as string = "Server='el_tetra';Database='DBName';uid='';pwd='';"<br />
Dim cn As New SqlClient.SqlConnection(cnStr)<br />
Dim strSelect as string = "SELECT * FROM MyTableName"<br />
Dim cmd As New SqlClient.SqlCommand(StrSelect, cn)<br />
Dim da As New SqlClient.SqlDataAdapter(cmd)<br />
Dim dt as New DataTable<br />
Try<br />
cn.Open()<br />
da.FillSchema(dt, SchemaType.Source)<br />
da.Fill(dt)<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
Finally<br />
cn.Close()<br />
End Try<br />
|
|
|
|
|
how can i implement the control access method to my application.say after login i wanted the name of the use been view to a formview ?can i do that with using vb.net and sql server express edition?
|
|
|
|
|
You're question doesn't make any sense. Are you asking how to get the currently logged on username?
Environment.UserName will return this as a string.
Dim currentUsername As String = Environment.UserName
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All,
I want to send SMS to Mobile using VB code when the internet connection is established.
Can any one of you help me regarding this?
Thanks in advance.
|
|
|
|
|
hi,
What a co-incidence , we share the same problem. Well, few months back i started working on it, and I've collection of various related files, like pdf's for AT-Commands, few codes that are supposed to work. If u r interested to share the treasure, just mail me at: ksandeeprao80@gmail.com.
Sandeep
Live the Life as it goes, stir it and u r in middle of twister
|
|
|
|
|
AND YES ONE THING I FORGET TO TELL U , I AM SERIOUS.
SANDEEP
LIVE THE LIFE AS IT GOES, STIR IT AND UR IN MID O TWISTER
|
|
|
|
|
hi,
I want to create a program for which user have rights to access limited programs rather than accessing entire program list.
According to the user permission, user can access the programs..
For Example...
For some user, Administrator wants to assign right to run only Inernet Explorer and MS office then a user can only able to access those applications.
For Other applications user should be restricted.
can you help me out?
Thankigg you.
-- modified at 2:00 Wednesday 8th February, 2006
|
|
|
|
|