|
The Split function never returns a delimiter. Example:
-------------------------------------------
strDelim = "\"
strFilePath = "C:\Program Files\MyApp"
strSplitPath = strFilePath.Split(strDelim)
-------------------------------------------
This code will return:
strSplitPath(0) = "C:"
strsplitPath(1) = "Program Files"
strSplitPath(2) = "MyApp"
Example 2:
-------------------------------------------
strDelim = "\"
strFilePath = "C:\Program Files\MyApp\"
strSplitPath = strFilePath.Split(strDelim)
-------------------------------------------
This code will return:
strSplitPath(0) = "C:"
strsplitPath(1) = "Program Files"
strSplitPath(2) = "MyApp"
strSplitPath(3) = null string (there was nothing after the third delimiter)
|
|
|
|
|
Thanks will sort things out now.....
Will post finnished App and Code when finnished...
|
|
|
|
|
hello...
can anybody help? is there a way to print what a textbox contains straight to the printer? i can't seem to figure it out... thanks!!
|
|
|
|
|
|
|
Tooting your own horn are you?
That article didn't exist at the time. And after seeing it, I wouldn't recommend it to anyone, yet. You've got a lot of work to do to clean up that code so it's readable, let alone orgainized into logical blocks. On top of that, I hate it when people just post code with some comments in it but don't actually write an article explaining the code and theory behind it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi! is there some sort of printer settings that i need to follow prior to the code? it doesn't seem to be working. if i use the "print a string" method, it justs prints the first letter. if i use the "print a file" methond, it prints only the first word.
|
|
|
|
|
On most printers today, you have to send a Form Feed character (ASCII 12) to the pritner to get it to form feed and print the contents of the buffer. If it still does not print, then there is some setting or flush commadn you hvae to send to the printer. But, only the documentation on the printer will tell you what that is. You might even have to go to the manufacturer to get that information.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
if u need i can send an example, Send email for demand
|
|
|
|
|
HELLO...there..
i hope someone can help me...to teach me how to insert animation text and graphic into the VB programming.
This is for my course project for Subject Human Computer Interaction. Title of my project course is...Pre-child Couseware..
So if anyone, whose know how to solve my problem...please reply to me...in addition to that, i m very gratefull if someone can give my a sample of SOURCE CODES programming that having animation on it. i hope to hear soon for you all. That's all thank you....
|
|
|
|
|
You need to use a control that can contain animation, such as a web browser ( flash ) or a windows media player (mpeg).
To animate text, just do it yourself.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
How do you perform a task like firing off a menu item in MS Word from a VB.NET Application?
Graham Irons
|
|
|
|
|
I need to convert a floating number to hex, then convert that number (Hex number) to decimal.
Can anyone help please!
|
|
|
|
|
A hex representation is going to be a string, so use string.format. Then use convert.ToDecimal.
I've never seen a floating point hex number before, what do you need that for ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi,
Could you tell me how to change a file's information such as description, comments, version, etc. I know I could get all this using the FileVersionInfo.GetVersionInfo but I am looking for the .SetVersionInfo equivalent.
Thanks,
Zenu
|
|
|
|
|
There is no SetVersionInfo equivalent.
There are no APIs to change versions, comments, and none needed. You don't change a version or comments of a file created by anyone but yourself, and you can do that through the various tools by which files are created - MS Office. Visual Studio,. etc.
You can change File Atrributes through both the CreateFile and SetFileAttributes APIs. You can change a file's creation, modification, and last access dates through SetFileTime.
Robert
|
|
|
|
|
Thanks for your response Rebort. No stealing I promise;).
I have a requirement to copy various files from one directory to another and then delete the original file. I also need to leave a file behind with information about the original. I was hoping to place this information in the comment field of this file, not the original. So in essnce I need to add this information during the creation of the replacement file.
BTW, you could right click a file and change these fields so why would you not be able to change it in code?
Any help would be appreciated.
Thanks,
Zenu
|
|
|
|
|
A compiled DLL or OCX does not allow you to change any of this information. In the case of a DLL the information is added into the compiled binary from a resource script that adds the information at compile time. There are OLE methods that allow this information to be read but not modifed, other than the file times. The only legitimate way to change version numbers etc. is to change the resource script and recompile, although there may be a way to hack the binary image.
But yes, it is true that you can right click certain types of files and change this stuff - for types that you could open, edit, and save yourself using the appropriate tools, like Word documents, etc.
This information is stored in some kind of summary information stream that is saved in the file. Assuming that the file you want to change allows you to do this, then at least in principle you can do it in code - obviously the Windows namespace shell tools have the capability to change the stream and resave the file.
In practice, the shell apis are poorly documented and pretty difficult to work with, and especially so in VB. Some types cannot be understood by VB6, and I don't kow about NET.
But if you want to try, I would start by looking at the various shell function header files in the Include folder of VC++, and see if you can find the function prototypes that allow Windows Explorer to read and write this information.
|
|
|
|
|
I will have a look at these function header files.
Thanks for the information
Zenu
|
|
|
|
|
Dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin, bOUT)
i get the error End of Statement Expected on the Above line of code
Imports System
Imports System.Windows.Forms
Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form
Public listener As Thread
Private Sub btnstart_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
btnstart.Enabled = False
btnstop.Enabled = True
listener = New Thread(New ThreadStart(AddressOf run))
listener.Start()
End Sub
Private Sub btnstop_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
btnstart.Enabled = True
btnstop.Enabled = False
If Not listener Is Nothing Then
listener.Abort()
listener.Join()
listener = Nothing
End If
End Sub
Public Sub run()
Dim len_receive_buf As Integer = 4096
Dim len_send_buf As Integer = 4096
Dim receive_buf() As Byte = New Byte(len_receive_buf) {}
Dim send_buf() As Byte = New Byte(len_send_buf) {}
Dim cout_receive_bytes As Integer
Dim socket As Socket = New _
Socket(AddressFamily.InterNetwork, _
SocketType.Raw, ProtocolType.IP)
socket.Blocking = False
Dim iphost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
socket.Bind(New _
IPEndPoint(IPAddress.Parse _
(iphost.AddressList(0).ToString()), 0))
socket.SetSocketOption(SocketOptionLevel.IP, _
SocketOptionName.HeaderIncluded, 1)
Dim bin As Byte() = New Byte() {1, 0, 0, 0}
Dim bout As Byte() = New Byte() {0, 0, 0, 0}
Dim sio_rcvall As Integer = &H98000001 _
dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin bout)
Do
Dim ar As IAsyncResult = socket.BeginReceive _
(receive_buf, 0, _
len_receive_buf, SocketFlags.None, Nothing, Me)
cout_receive_bytes = socket.EndReceive(ar)
Receive(receive_buf, cout_receive_bytes)
Loop
End Sub
Public Sub Receive(ByVal buf As Byte(), ByVal len As Integer)
If buf(9) = 6 Then
lbpackets.Items.Add(Encoding.ASCII.GetString _
(buf).Replace(Chr(0), " "))
End If
End Sub
End Class
|
|
|
|
|
You're killing yoursel;f with all these line continuations. Just don't use them this much.
This is what got you into the trouble. Remove the line continuation character (_) from the line BEFORE the one that threw the error:
socket.Bind(New _
IPEndPoint(IPAddress.Parse _
(iphost.AddressList(0).ToString()), 0))
socket.SetSocketOption(SocketOptionLevel.IP, _
SocketOptionName.HeaderIncluded, 1)
Dim bin As Byte() = New Byte() {1, 0, 0, 0}
Dim bout As Byte() = New Byte() {0, 0, 0, 0}
' This next line caused the error...
Dim sio_rcvall As Integer = &H98000001 _
dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin bout)
Do
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
cool it is working now ty for the help
|
|
|
|
|
I don't know if this affects C#, but it was pointed out to me that a .NET application uses huge amounts of memory. I was wondering if anyone could shed some light on this or send me some links on Memory Management?
For example, create a new VB.NET Windows Forms project. Do NOT add any code to the Form. Run the program and look in the task manager under your Program Name. You'll notice probably about 8,000 - 12,000 kb of memory being used. Now, Minimize the Form and the Memory drops to 600 - 650kb!!! Restore the Form and now it only uses 1500 - 2000 Kb of Memory! What in the world is going on!?
Has anyone else noticed this? I have a feeling it has something to do with GDI and Painting but I am not sure.
|
|
|
|
|
It's nothing you have to worry about and just about everyone has noticed this.
When your app is launched, you have the entire weight of the .NET Framework loaded behind it, taking up a bunch of RAM. When your app is minimized, a bunch of data and code is moved to the page file and out of RAM since it's not being used by a foreground process. When your app is maximized again, only the data and code that gets executed and referenced gets moved back into RAM and out of the page file. When the is being used and exercised, more data and code will get moved back into RAM while seldom used data and code gets moved back to the page file. It's that simple.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Rage - do you happen to know if, in a System Tray application, the memory remains allocated? Looking at the Task Mgr, it seems that my fairly simple app is sucking 12MB while the icon just sits there. Thanks!
Hal in AZ
|
|
|
|
|