|
Use an enum as the parameter.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
You may always want to add a default: to your switch that throws an exception, in case one day a new value is passed in and not acted on. I do that with all switch statements where I expect every value passed in to do something. This would also work with the string approach, but enums are a lot better, not least for intellisense and to avoid typos.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
do you have an example of the switch?
thanks for your info so far
|
|
|
|
|
Switch is nothing but Select
|
|
|
|
|
i have files uploaded to server now i have one more window in which i have to open the files from server. how to impliment same in vb.net (windows). plz help.
|
|
|
|
|
Please try and explain what you are trying to do a little more explicitly. Preferably using punctuation.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hello
i upload files from a window using button control. the files i upload are scanned bills. now to check the bills, i created one more form, in which i need to download the bills from server, that i uploaded previously.
how to do that.
it is just like attachments in windows Outlook that are opened in their respective applications upon clicking on them.
|
|
|
|
|
I assume then they are images of some kind, so you just need to open them in a PictureBox control.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i know i can use imagebox but i want to do it differently. like i take it for file can be any type file. that is what i need to know how to do it.
|
|
|
|
|
read the folder first and check how many files are there
and loop through each and every file reading its suffix ie .jpg or .png
and store the filename in some sort of variable and pass it to any function ... do whatever you want to do with that file in that function.
|
|
|
|
|
thanx i ll try it but please find a solution if i can't
|
|
|
|
|
How do I create a server socket which can accept multiple connection on the same port?
Just about every source I found on the internet explains that a Socket-array is used to do this, but that doesn't make sense to me. Even if I use a socket array, if mySocket(1) listens on port 9700, mySocket(2) cannot listen on that same port since the "address is already in use".
I've read sources explaining that the socket should be "moved off" to another port after the initial connection, which means that the host should reply to the incoming connection with a new port number... is there a standard global way of doing this?
Example... I can VNC my PC over the internet from two different VNC clients at the same time i.e on the same port, how does that server accept more than one connection? "Moving the port off" doesn't seem like a viable solution since the router only has one port forwarding entry on a single port, yet it work fine for multiple connections... but how does this work?
The application I am tasked to upgrade is a VB6 application, hence I'm using Winsock, but help in .Net is just as fine, I'm more after the principal than the actual code.
Kind Regards
|
|
|
|
|
You must Listen to incomming requests on a different thread and create a new thread to accept the socket and pass the socket reference to created thread.
After that your listener can accept other incoming requests.
|
|
|
|
|
evilnoodle wrote: How do I create a server socket which can accept multiple connection on the same port?
When a socket is 'listening' and someone connects, the .Accept() method of that socket will return a new socket which is 'talking' to whoever called in. Once that has been done, the 'listening' socket can accept another connection. When that connection comes in, .Accept() will return a different socket which can exchange data with the new caller. After a connection is handed off to a new socket with .Accept(), the original listening socket will no longer "care" about it. There are practical limits to how many sockets can be connected at once, but if one creates a new thread for each socket it's pretty easy to handle quite a few.
Note that starting a new thread for each socket isn't strictly necessary, but it's often the easiest way to do things. The biggest 'gotcha' is that the new threads won't be able to interact with the UI directly.
|
|
|
|
|
Thank you, this will really help!
|
|
|
|
|
Hello,
I am extracting files from zip file using the following code.
It works wll but the only problem is that the command prompt wwindow is popuping. What is the syntax to hide it?
Const WzunzipExe As String = "C:\Program Files\WinZip\Wzunzip.exe"
Dim WSHShell As Object = CreateObject("Wscript.Shell")
WSHShell.exec(WzunzipExe & " " & ZipFullPath & " " & """" & ExtractToFolder & """")
--Modification-----------------------------------
I found solution using the Shell command, but I still would like to know how to do it with exec if possible
thanks
--------------------------------------
Thanks for help
Shay Noy
modified on Wednesday, August 13, 2008 5:48 AM
|
|
|
|
|
IIRC, the Exec method has no options to do this. You can't tell it to launch the application with the window hidden.
|
|
|
|
|
|
|
Hi
I want to send a var from my friend’s web site to mine when someone clicks on a hyperlink to my web site. He is using HTML and I am using ASPX pages with VB code behind. The var is a static text value. There is more then one. I need to know witch text to use on my side
|
|
|
|
|
I guess you meant to ask in the ASP.NET forum ? Only way to do this is to put it on the URL.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
www.myURL.com?myvar=myvalue
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Do u put that in the hyperlink Href ?
and how do i read it in my ASPX page?
|
|
|
|