|
Hi!
Is there a way to use "function handles in VB 2010"?
For instance, let's suppose to define an array of sub or functions:
array1 = {sub1(), sub2(param1, param2), sub3(param3)....}
I would like them to be called in the sequence specified within array1 from another sub, let's say a "server sub"
for i = 0 to N_MAX
INVOKE_FuNCTION(array1(i))
end
Lines before were in "symbolic" language (not true VB, of course).
Is there a way to build array1 and to subsequently call the therein contained functions, as stated above?
Thanks!
...............................................
For who is interested in my troubles....
I am using the System.Windows.Form.WebBrowser and I have a sequence of operation to perform programmatically, each of which requires the DocumentCompleted event to be triggered. My idea was to put the for loop within the function DocumentCompleted function, in order to call the operations being sure the web page is loaded. This allows the sequence of function to be changed. tnx!
Do While ReadyStatus = False
Loop
ReadyStatus = False
End Sub
|
|
|
|
|
Sure. "Function pointers" as you called them are Delegates in .NET.
Read this[^].
|
|
|
|
|
|
I have a code for displaying all files inside a folder in a FTP Server,
but I don't know how to view a folder inside of a FTP Server or
inside an another folder.
Here's the code to display a file inside a folder
reqFTP = DirectCast(WebRequest.Create("ftp://ftp.microsoft.com/"), FtpWebRequest)
reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails
reqFTP.Credentials = New NetworkCredential(UserID, Password)
response = DirectCast(reqFTP.GetResponse(), FtpWebResponse)
Dim responseStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(responseStream)
Dim CrLf As Char() = {Constants.vbCr, Constants.vbLf}
Dim lines() As String = reader.ReadToEnd().Split(CrLf, StringSplitOptions.RemoveEmptyEntries)
Dim lineArr() As String
For i As Integer = 0 To UBound(lines)
lineArr = Split(lines(i))
lstFTPfiles.Items.Add(lineArr(UBound(lineArr)))
Next
responseStream.Close()
response.Close()
reader.Close()
Example in ftp://ftp.microsoft.com/
In root directory it has a sub folders
Folder1
Folder2
I want to put that two sub folders in a ListBox.
|
|
|
|
|
According to several hits found with Google, the LIST and NLIST FTP commands return information on files and folders all together. You need to look at the details, and for a folder call LIST or NLIST recursively.
Here[^] is a CP article that does things similar to what you want, it is in C#, look for file "Program.cs"
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
yah your right all files and DIRs will be shown when getting the list in FTP, actually my problem is not in my code, in my sample FTP Server. I choose a FTP location that has files only(ftp://ftp.microsoft.com/bussys/mspress/Excel2000/), but when I try it to root location in FTP Server all files and folders appear, my problem is so simple actually.
|
|
|
|
|
Long time ago I sent raw ZPL via the comm port. Now I would like to print to Zebra's shared off the same server.
It needs to be a two way communication: request the Zebra status - and then download the raw ZPL to print the label.
I've never used the TCP/IP classes. If anyone could point me in the right direction, I'd appreciate it.
|
|
|
|
|
If the Zebra printers are in a Windows environment, then have the network administrator setup a printer queue and your application can send its output to that queue. Let the print server determine if the printer is ready or not.
Would this work for you ?
|
|
|
|
|
I haven't done a lot of interfacing to windows printers - have used mainly 3rd party reporting tools.
Here's what I envisioned:
Table descriptive printer name and IP address - for picklist
No printer driver required to be installed - these are all Zebra printers, but some are different models
Connect to printer
Send ~H1 - read status command to Zebra
Wait for response - make sure ready, has correct label size, has ribbon. (these printers could be in another building - so I have to know if they're ready)
Send raw ZPL to printer.
Done!
Does your print queue idea provide for this?
|
|
|
|
|
I spoke with one of the guys I work with and he has used a component from the following company to interface his applications to our Zebra printers.
Scroll down on the web page and look for "Raw Data Printer Component"
Maybe this will work for you.
http://www.vbgold.com/[^]
|
|
|
|
|
Looks like that might work.
Could you ask your friend if it's bi-directional.
Thanks!
|
|
|
|
|
My colleague does not use it for 2 way communication, so we cannot confirm or deny whether this functionality is available. However, it may not be necessary. Our approach is to just "send" the label data (ZPL code). The printer has its own print-server logic in it so that if a label is currently being printed it will cause the second label to queue up and wait.
|
|
|
|
|
Thanks for the info and the followup!
|
|
|
|
|
Can any one teach how to a SQL Stored procedure in vb.net 2008 ?
|
|
|
|
|
|
I have vs2005. Someone put together a project for us in vb6, but
when I try to open in vs2005, it converts, but doesnt compile and
I dont really see the source code.
I have projects in vc6 and those will convert to vs2005.
Does vc6 exist? Is there a way of downloading it?
|
|
|
|
|
DanYELL wrote: I have vs2005. Someone put together a project for us in vb6, but
when I try to open in vs2005, it converts, but doesnt compile and
I dont really see the source code.
You cannot compile VB6 code with VS2005. You'll need VS6.
DanYELL wrote: I have projects in vc6 and those will convert to vs2005.
Does vc6 exist?
Yes, Visual C 6 exists, as does Visual Basic 6. What language are your source-projects in? Is it basic or C? If you're coming from Basic, you might want to check out the interop-toolkit from Microsoft, allowing one to mix VB6 and .NET code.
DanYELL wrote: Is there a way of downloading it?
Visual Studio 6 has to be bought, it's not a free product.
Bastard Programmer from Hell
|
|
|
|
|
THe conversion process is not perfect, so it's not guaranteed to work. You should have the source available in the Solution Explorer. If it doesn't show up there, I don't know what's wrong with the project.
Your best bet for converting VB6 to VB.NET is to start rewriting the project by hand. You can use converted code in the new code, but the conversion process adds a bunch of code to maintain backwards compatibility for the VB6 code. Not the best solution. The conversion is there so you don't end up rewriting the entire project from scratch all at once. You can rewrite sections at a time.
|
|
|
|
|
|
Hi,
This is an easy one, I think.
I have written a procedure behind a button e.g.
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
I want to call this procedure from a timer function, how is this done?
Thanks in advance.
|
|
|
|
|
How would you call any subroutine?
The best things in life are not things.
|
|
|
|
|
1.
why would you put code in a button click handler, if what you want is have it executed by a timer tick handler?
2.
you can simulate a button being clicked by calling Button.PerformClick
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
You don't put the code in the Button Click event handler. You put code in its own Sub, then call it from the Button Click handler and the Timer Tick event handler.
|
|
|
|
|
just call btnProcess.PerformClick() in timer.tick event.
or
btnProcess_Click(sender, nothing) in timer.tick event.
|
|
|
|
|
That's the very wrong way to do it. It's lazy and leads to other possible issues that can't be traced down easily.
If there is code that needs to be executed from multiple places you stick it in its own method with a name that has meaning as to what the code does. You don't "hide" it inside an event handler.
|
|
|
|