|
hi
No chance for any mishap, it shud work. Just chk the export list of shell32 using object browser whether those methods are there in the specified class. I tested it on Win2k professional and works fine.
rgds..mil10
|
|
|
|
|
hi
Cool man Thanks Very much the code is working too much file but with a little change i dont know why but the change is
Dim objFolder As Folder2 in the deceleration section.
Because in the Intellisence list their two Folder options one is FOLDER and other is FOLDER2.
Folder2 option contains the procedure PARSENAME() .
Any way thanks very much for the Help
Eman Ali Moughal
Senior Software Engineer
Soon Soft (pvt) Ltd
www.soonsoft.com
|
|
|
|
|
I am trying to put a header on each of my columns in my data grid. I am getting an error while trying to run it. It is telling me that
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
The error is on the first line in this part of the code.
What am I doing wrong? I have a total of 6 columns. Any suggestions.
dgPayrollInfo.GridColumnStyles(0).HeaderText = "Employee ID"
dgPayrollInfo.GridColumnStyles(0).Alignment = HorizontalAlignment.Center
dgPayrollInfo.GridColumnStyles(1).HeaderText = "Payroll ID"
dgPayrollInfo.GridColumnStyles(1).Alignment = HorizontalAlignment.Center
dgPayrollInfo.GridColumnStyles(2).HeaderText = "Pay Date"
dgPayrollInfo.GridColumnStyles(2).Alignment = HorizontalAlignment.Center
dgPayrollInfo.GridColumnStyles(3).HeaderText = "Gross Pay"
dgPayrollInfo.GridColumnStyles(3).Alignment = HorizontalAlignment.Right
dgPayrollInfo.GridColumnStyles(4).HeaderText = "Withholding"
dgPayrollInfo.GridColumnStyles(4).Alignment = HorizontalAlignment.Right
dgPayrollInfo.GridColumnStyles(5).HeaderText = "Net Pay"
dgPayrollInfo.GridColumnStyles(5).Alignment = HorizontalAlignment.Right
Thank you,
ibok23
|
|
|
|
|
I am trying to get the caption/title string of a hidden window, which is bascally a cmd.exe running in the background (not visible on screen). But using GetWindowText() function, I get an empty string back.
If I make that cmd.exe window visible, then it extracts the right caption of that window.
Any idea on what should I use if I have hidden process running in background to get its caption/title bar??
Many Thanks.
|
|
|
|
|
hi
If GetWindowText returns empty string then it means that the window does not exist at all. GetWindowText will return the exact caption even if the window is invisible. So if GetWindowText returns NULL then either the window does not exist or the window doesn't have a caption.
Use Spy++ ( comes with visual studio ) to inspect all active windows and processes.
rgds..mil10.
|
|
|
|
|
OK, I dont know but it doesn't work for me .
If you like, I can send you my code.
Anyways, any idea on how to get only hidden processes listed in VB?
Thanks.
|
|
|
|
|
Hi
I just back to my machine 2day morning ,after easter vacation.
Ok u send me the code. i shall try it out. to get all running process details try thr following.
Call TerminateProcess to terminate a process. This needs the process handle as input. Call OpenProcess to get the process handle. This needs processId as input. Call Process32First and Process32Next to loop thru the running process and to get the ProcessId. Call CreateToolhelp32Snapshot before calling Process32First .
sample code is available on msdn.
rgds..mil10
|
|
|
|
|
The following is the way to put the button and also add the functions for ConnectButton and DisconnectButton when those buttons are pressed.
however, whenever press one of button two functions will be executed instead of only the one with pressed but both of them. Why is that?
Dim WithEvents ConnectButton As CommandBarButton
Dim WithEvents DisconnectButton As CommandBarButton
' Connection Button
With ConnectButton
.Style = msoButtonIconAndCaption
.Caption = "Connect"
.FaceId = 19
.ToolTipText = "Press me for fun and profit."
'.OnAction = "ConnectButton"
.Tag = "My Big Button"
End With
'Disconnection Button
Set DisconnectButton = _
.Add(msoControlButton)
' Disconnect Button
With cbcDisconnectButton
.Style = msoButtonIconAndCaption
.Caption = "disconnect"
.FaceId = 19
.ToolTipText = "disconnect from iims"
'.OnAction = "DisconnectButton"
.Tag = "My Big Button"
End With
|
|
|
|
|
You're supplying the wrong code. What you should be looking at is the tail end of the Click handler functions for each button. Does they say something like this:
Private Sub ConnectButton_Click( ... ) Handles ConnectButton.Click, DisconnectButton.Click
What you problem is is two functions are handling the Click event for one button. Make sure that you don't see two event tags, or the wrong event tags at the end of the function declaration.
RageInTheMachine9532
|
|
|
|
|
>You're supplying the wrong code. What you should be looking at is the tail >end of the Click handler functions for each button. Does they say something >like this:
thanks i didn't have anything at the back of function name just
Private Sub ConectButton_Click()
{
..
}
so that's why, right. I only need to do is to put this handles statement
in order to get it work for each event.
Thanks for your help.
Shiny
|
|
|
|
|
With a ComboBox, I can write ComboBox1.DroppedDown = true.
How can I do the same with DateTimePicker?
Thank you,
Dino
Dino Buljubasic
|
|
|
|
|
With a ComboBox, I can write ComboBox1.DropDown = true.
How can I do the same with DateTimePicker?
Thank you,
Dino
Dino Buljubasic
|
|
|
|
|
Hi, I'm having the same problem. Did you solve this?
/=/=/=/= Sagmam =\=\=\=\
|
|
|
|
|
|
Some time ago I developed a custom control in a Class Library project. It has worked flawlessly, but over the weekend, as I was trying to deploy my application, It suddenly started giving problems. When ever I open the solution which references the custome control, I get a build error "Specified cast is not valid".
I can still build the application and it works fine, but the design view of the custome control won't open. I get the same error message on the [Design]tab. I also tried to close the form and reopen it. The same thing happens. I have tried removing the custome control and re-adding it (and the reference to it) to the solution, but that doesn't help. I'm not even sure whether the problem is in the custom control or in the project that reference it.
Help!
|
|
|
|
|
So yeah, I need some help. I want to create a sub that will allow me to select a source file, select a destination text (.txt) file, and write to that text file the code neccessary to programatically create the source file.
Why would I do such a ludicrously convoluted thing, you ask?
1) I need to create programs that automatically detect whether or not there is a certain file in the root folder, and if that file doesn't exist, I want it to create the file (i.e. a ReadMe file, usually an HTML file).
2) Since they are usually HTML files and I know squat about HTML, it would be easier just to create the file (using OpenOffice.Org in my case), and automate the arduous task of retrieving the HTML source.
3) I don't really have a third thing, but I felt three was the neccessary number of topics to address, and figured it'd be lame to stop at two.
Here's what I have so far:
Public Sub FileCopyCode()<br />
'Declaring variables<br />
Dim FileOpen As OpenFileDialog<br />
Dim SourcePath, OutPath As String<br />
Dim FileSave As SaveFileDialog<br />
Dim SourceFile As System.IO.File<br />
Dim SourceWrite As System.IO.StreamWriter<br />
'Starting the procedure<br />
FileOpen.ShowDialog()<br />
SourcePath = FileOpen.FileName<br />
FileSave.Filter = "Text File|txt"<br />
FileSave.ShowDialog()<br />
OutPath = FileSave.FileName<br />
SourceWrite = SourceFile.CreateText(OutPath)<br />
Dim SourceRead As System.IO.StreamReader<br />
SourceRead = SourceFile.OpenText(SourcePath)<br />
'Now, if I could just set up a loop starting here...<br />
'::Count number of lines in source file, loop following_<br />
'_procedure that many times::<br />
SourceWrite.WriteLine("FilePut(1, " & SourceRead.ReadLine)<br />
'...and ending about here, then maybe I could copy_<br />
'_each line with the FilePut thing in front, and boom! I'd have_<br />
'_what I want<br />
End Sub 'How to programatically create a text file containing the <br />
'_VB.Net code neccessary for recreating a different file programatically<br />
Any help is appreciated, thanks.
As I sit here, I contemplate the last words of Socrates: "I drank what?".
|
|
|
|
|
...
so u want to make a sub which will create a text file. this text file it creates must include the text (code) which is required to create a text file...?
doesnt seem hard, i can help you out. i just dont want to go do this and not be what is requested.
------------------------
Jordan.
III
|
|
|
|
|
Herm... let me try to explain it better:
Say, for example, you create a ReadMe file you plan to use with your program. The file is an HTML file, because you like to use funny formats and hyperlinks and whatnot. Anyway, you want your program, when started, to check the root folder and see if that file exists there. If it doesn't exist, you want your program to create that file. What would you do? You would code your program to check for the file and create it if it doesn't exist, simple as that.
Now, in the case of HTML files, you'd have to type the code to write the file line by line, as in the following example:
Public Sub CopyMake()
copyrightFile = Application.StartupPath & "\Copyright Info.htm"
If System.IO.File.Exists(copyrightFile) = False Then
FileOpen(1, copyrightFile, OpenMode.Binary)
FilePut(1, "<html>" & Environment.NewLine)
FilePut(1, Environment.NewLine)
FilePut(1, "<meta http-equiv='Content-Language' content='en-us'>" & Environment.NewLine)
FilePut(1, "<meta name='GENERATOR' content='Microsoft FrontPage 5.0'>" & Environment.NewLine)
FilePut(1, "<meta name='ProgId' content='FrontPage.Editor.Document'>" & Environment.NewLine)
FilePut(1, "<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>" & Environment.NewLine)
FilePut(1, "<title>Framework Download</title>" & Environment.NewLine)
FilePut(1, "</head>" & Environment.NewLine)
FilePut(1, Environment.NewLine)
FilePut(1, "<body>" & Environment.NewLine)
FilePut(1, Environment.NewLine)
FilePut(1, "<p>Coded by Mike</p>" & Environment.NewLine)
FilePut(1, "<p>Project started on Wednesday, March 24, 2004</p>" & Environment.NewLine)
FilePut(1, "<p>Email me at:</p>" & Environment.NewLine)
FilePut(1, "<a href='mailto:CodeMonkey85@hotmail.com'>" & Environment.NewLine)
FilePut(1, "codemonkey85@hotmail.com</a></p>" & Environment.NewLine)
FilePut(1, Environment.NewLine)
FilePut(1, "</body>" & Environment.NewLine)
FilePut(1, Environment.NewLine)
FilePut(1, "</html>" & Environment.NewLine)
FileClose(1)
End If
End Sub
As lazy as I am, I would hate to type all of that. So I thought to myself, "Self, you know how to programatically create simple text files, and how to read text from other files. You could easily program a routine to read from an HTML file like the one created above, and simply write the code required to create the file into a text file." And this is what I want to do.
I want my sub to read, for example, an HTML file. Since it only reads simple text, it would read the HTML source. Then, I want it to append whatever VB.Net code is required to programatically create the file (as in the example above), and write the result to a text file, which I can simply copy and paste into my new project. It should go something like this:
1. I run the sub, and it shows a file open dialog. I choose the source file (for example, an HTML file).
2. I pick a destination file path and file name (let's say I wanted it saved on my desktop) for the intended text file.
3. The sub reads the source file, writes the source to the destination text file and appends the VB.Net coding required to recreate the file in a different sub.
4. Now, if I open the text file, a sub that creates the source file I picked should be in there. I can copy and paste this into a project, and when I run that sub, it will recreate the file I picked at the beginning of the other sub.
I hope you all understand this now. I tried to be specific and all.
As I sit here, I contemplate the last words of Socrates: "I drank what?".
|
|
|
|
|
wow. i must be an idiot. still lost.
ok, the sub will:
1 - select file to read (html file)
2 - select file to save output to (txt)
3 - take the txt in the html (input) file and saves it to the txt (output) file, including the actual vb code required to do this.
ok for demonstration purposes:
myHomePage.html:
----------------------------------------------------------------------------------------------
<html>
<title>Heres my title</title>
<body>
<p>here is all my text for the web page.</p>
</body>
</html>
----------------------------------------------------------------------------------------------
myDoc.txt (after program executed):
----------------------------------------------------------------------------------------------
Private Sub MakeFile()
Dim inFile As StreamReader = File.OpenText(Application.StartupPath & "\myHomePage.html")
Dim outFile As StreamWriter = File.CreateText(Application.StartupPath & "\myDoc.txt")
outFile.Writeline("<html>")
outFile.Writeline("<title>Heres my title</title>")
outFile.Writeline("<body>")
outFile.Writeline("<p>here is all my text for the web page.</p>")
outFile.Writeline("</body>")
outFile.Writeline("</html>")
outFile.Close()
inFile.Close()
End Sub
----------------------------------------------------------------------------------------------
is this somewhat on the right track?
------------------------
Jordan.
III
|
|
|
|
|
Err, not quite. First of all, I don't want to have to hardcode the source into the program, or else 1) what would be the point in selecting the source file, and 2) it would have to be modified and recompiled each time I wanted to copy a file.
I want a sub that would take your example HTML file, and create a text file containing this:
Private Sub MakeFile()
Dim inFile As StreamReader = File.OpenText(Application.StartupPath & "\myHomePage.html")
Dim outFile As StreamWriter = File.CreateText(Application.StartupPath & "\myDoc.txt")
outFile.Writeline("<html>")
outFile.Writeline("<title>Heres my title</title>")
outFile.Writeline("<body>")
outFile.Writeline("<p>here is all my text for the web page.</p>")
outFile.Writeline("</body>")
outFile.Writeline("</html>")
outFile.Close()
inFile.Close()
End Sub
This would be a text file containing the VB.Net code required to remake the source file, which is what I want the original sub to make. In other words, if I were to run this code on a program (that is to say, the code in the new text file), it would create the myHomePage.html file in the bin folder.
As I sit here, I contemplate the last words of Socrates: "I drank what?".
|
|
|
|
|
didnt u just repeat me?
in your last post u copied and pasted my example for the txt document output, and said that that is what you want it to show... well thats exactly wut i was asking. i pasted that code there as an example of what the output for the txt file is that you are looking for, is that exactly what you are looking for? im working on it right now, post in afew minutes.
------------------------
Jordan.
III
|
|
|
|
|
ok.. is this more accurate:
ACTUAL CODE FOR SUB:
-------------------------------------------------------------------------------------------------------
Private Sub MakeFile(ByVal source As String, ByVal destination As String)
Dim inFile As StreamReader = File.OpenText(source)
Dim outFile As StreamWriter = File.CreateText(destination)
outfile.WriteLine("Private Sub MakeFile(ByVal source As String, ByVal destination As String)")
outfile.WriteLine("Dim inFile As StreamReader = File.OpenText(source)")
outFile.WriteLine("Dim outFile As StreamWriter = File.CreateText(destination)")
outFile.WriteLine()
Do Until inFile.Peek = -1
outFile.WriteLine("outFile.WriteLine(" & Chr(34) & inFile.ReadLine & Chr(34) & ")")
Loop
outFile.WriteLine()
outFile.WriteLine("outFile.Close()")
outFile.WriteLine("inFile.Close()")
outFile.WriteLine()
outFile.WriteLine("End Sub")
outFile.Close()
inFile.Close()
End Sub
-------------------------------------------------------------------------------------------------------
CONTENTS OF .txt FILE AFTER PROGRAM EXECUTED:
-------------------------------------------------------------------------------------------------------
Private Sub MakeFile(ByVal source As String, ByVal destination As String)
Dim inFile As StreamReader = File.OpenText(source)
Dim outFile As StreamWriter = File.CreateText(destination)
outFile.WriteLine("<html>")
outFile.WriteLine("<title>Heres my title</title>")
outFile.WriteLine("<body>")
outFile.WriteLine("<p>here is all my text for the web page.</p>")
outFile.WriteLine("</body>")
outFile.WriteLine("</html>")
outFile.Close()
inFile.Close()
End Sub
-------------------------------------------------------------------------------------------------------
for the .txt file part above (the outfile.writeline("<html>")) part), is that correct? or should it display the Do/Loop as shown at the top (in the actual sub's code), in place of all the 'outFile.WriteLine' commands with the html tags
------------------------
Jordan.
III
|
|
|
|
|
Yayness! It works! Unfortunately, when I try to copy certain files, quotation marks tend to get in the way... but for my purposes this will do just fine. Thanks for the help!
As I sit here, I contemplate the last words of Socrates: "I drank what?".
|
|
|
|
|
is that wut u were looking for? or did u solve it? if so, post your method.
i got around the quotation mark problem by using Chr(34) so there shouldnt b a problem.
------------------------
Jordan.
III
|
|
|
|
|
Ummm...why not just keep another copy of the files somewhere? Then write an app that can compare the last modified times of the working copies to the stored copies and if they are different, copy the stored copy back out to the working copy?
RageInTheMachine9532
|
|
|
|
|