|
|
Member 4705584 wrote: i chose that metod becose "the boss" of company wants to check from home, office and cell phone
Just on this specification, using FTP was a poor design choice. Your implementation is MUCH slow than the "real time" provided by a VNC implementation. Also, it will only show a frame in time unless your management side implementation refreshes its image constantly.
Your design assumes that the FTP server will tolerate having a logged in connect indefinitly. You have no error checking, you're using VB6 constructs in VB.NET code, you have no methods of seeing if you actually have a good connection to the server, your code is logging into the FTP server over and over again, possibly running the FTP server out of connections. Your design also relies on a specific network configuration where you do not support proxy servers and you leave yourself open to file-based issues such as a file being written and viewed at the same time.
I can't fix this without trashing everything you have and starting over...
|
|
|
|
|
|
can annyone help me???
i need something like:
In form 1 class:
<br />
Dim FileUploadedSuccessfuly As Boolean = True<br />
Dim cls_request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(remote_file), System.Net.FtpWebRequest)<br />
Dim user_name As String = "root"<br />
Dim password As String = "administrator"<br />
cls_request.Credentials = New System.Net.NetworkCredential(user_name, password)<br />
cls_request.KeepAlive = True<br />
cls_request.Proxy = Nothing<br />
cls_request.Method = System.Net.WebRequestMethods.Ftp.UploadFile<br />
cls_request.UseBinary = True<br />
so that when form is loaded that it connects to server and stay connected
and then in timer:
<br />
If FileUploadedSuccessfuly = True Then<br />
FileUploadedSuccessfuly = False<br />
CatchScreen()<br />
Dim remote_file As String = WORKSERVER & "/" & System.IO.Path.GetFileName("C:\EMON\bin\tmp_" + THISPCUsername + ".jpg").ToString<br />
Dim cls_request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(remote_file), System.Net.FtpWebRequest)<br />
Dim b_file() As Byte = System.IO.File.ReadAllBytes("C:\EMON\bin\tmp_" + THISPCUsername + ".jpg")<br />
Dim cls_stream As System.IO.Stream = cls_request.GetRequestStream()<br />
cls_stream.Write(b_file, 0, b_file.Length)<br />
cls_stream.Close()<br />
cls_stream.Dispose()<br />
FileUploadedSuccessfuly = True<br />
End If<br />
thats all i need for now! only problem is underlined...
thx, and thanks dave , now i have to do this and then after a month or more i will go redesigning!
|
|
|
|
|
hi for all
I want use Virtual Ketboard in vb.net forms beacause my screen is touch screen
but i not found any component
please guide me
Thanks
|
|
|
|
|
If you had searched CP articles, you would have found this[^] article.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi d@nish Thank you For Your Reply
But I want This code in vb.net
if possible send me a dll file or component for this job
thanks
|
|
|
|
|
All you have to do is convert the code yourself. It's only C#, not rocket science. There are a ton of online code converters on the web. All you need to do is a simple search.
Or, you can just leave that component as is, compile it yourself, then use the resulting library in your VB.NET project.
|
|
|
|
|
As Dave said, either convert it yourself (lots of means available) or just add a reference to it in your code and use it.
You might have read "interoperability" as advantages of .Net framework, you can make use of that now.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
hi,
i would like to make a program in visual basic 9 to comunicate via Modbus with a PLC.
I alrady done one with vb6 but with vb9 (visual studio 2009) i can't.
The problem is this: when i make a string to send to PLC i send the byte as char but, when the byte is equal to "00" or to "01" the software don't send anything.
In vb6 this don't appened... some one can help me please?
Thanks
Joshua
|
|
|
|
|
Would the ASCIIencoding class help? it contains GetChar and GetBytes so using these you should be able to get anything you want to send to the PLC.
I am a bit confused by your question, as in what exactly you are trying to send out.
|
|
|
|
|
i explain better, in vb6 I send a modbus message in this way:
mscom.write("1")
mscom.write("2")
mscom.write("0")
mscom.write("0")
mscom.write("0")
mscom.write("1")
mscom.write("2F")
and all work good.
if I do the same thing in vb9 (visual studio 2009) it doesn't work.
Now it try in the way that you say
thanks
|
|
|
|
|
You shouldn't use strings when your data should be able to contain zero-valued bytes, use the Read and Write overloads that work with byte arrays. And if some of your message is text, use Encoding.GetBytes/GetString, probably for the ASCII/ANSI encoding.
|
|
|
|
|
hi
using vb, i can open a AutoCad drawing and pass few values/commands to the
autocad.This is one way communication i.e from vb to Autocad
now i need two way communication
i.e
vb to AutocAD (which i said above)
AND
AutoCad to vb
AutoCad to vb means when AutoCad Drawing is opened using vb
if user picks/select a point in Auto Cad then i want to show a vb form
is it possible
|
|
|
|
|
This depends on several things;
1) what method is being used to send the messages to Autocad, is it simply command line arguments, DDE or some other protocol
2) What does the Autocad documentation tell you? does it have any automation API's that support communication
Have you tried searching Google or the Autocad support forums?
|
|
|
|
|
hi
thanks for your reply
1)i didnt used any method till now, thats what i want to know
what method is used to show a form when user selects a point or object in Autocad.
i explain you where i stucked .....
Data i have is a autocad drawing file is stored at a place in the user system
Step1)i will open the Drawing file by using path specifed by the user
step2)the drawing file is opened using step1 and at this stage user will picks or selects a point in the drawing file then i have to show a form designed in vb
i stucked at this stage, i can open only the drawing file
is it possible with vb.net or vb or vba
i searched in google and found few articles , i followed them but i could not achevied it
|
|
|
|
|
|
hey
i use the com "microsoft outlook 11.0 object library"
and the following code
dim app as new outlook.application()
dim ns as outlook.namespace = app.getnamespace("mapi")
ns.addstore("c:\test.pst")
my problem is the pst file is created but the folders like sent,inbox,.... are missing
any one a solution ??
thanks
|
|
|
|
|
Hello there,
I would like to know if it´s possible to randomly pick a number based on a percentage, for example: from 1 to 5.
nº %
1 10%
2 20%
3 10%
4 20%
5 40%
I have 40% to pick 5 instead of the others. Is it possible to be implemented in VB2005 ?
|
|
|
|
|
Hi,
Of course it is possible. Here is the simplest approach:
- allocate an array of 100 elements;
- now fill it according to your specs (10 ones, 20 twos, 10 threes,...); order does not matter.
- now get a random number from Random in the range [0,99];
- use it as an index into the array, and get the element.
Obviously, you do not really need the array, you could replace it with a couple of conditionals, in pseudo-code:
if num<10 then return 1
if num<30 then return 2
if num<40 then return 3
if num<60 then return 4
return 5
|
|
|
|
|
The easiest general solution for a very small # of discrete states is to invert the CDF. Generate a uniform on [0,1].
When it's between [0, .1) map to 1, [.1, .3) map to 2, [.3, .4) map to 3, [.4, .6) map to 4, [.6, 1) map to 5.
|
|
|
|
|
And how is that any different from what I posted?
|
|
|
|
|
It's very similar, but most likely is less efficient given the implementation of Random. (Yes I have designed several simulation algorithms before).
Random generators are typically designed to generator random unsigned longs of uniforms efficiently.
The generators that give you a random integer have an unnecessary multiplication thrown unless of course
they are specialized for powers of two where they use bitwise operators.
|
|
|
|
|
I am trying to pass a two dimensional array in Visual Basic. Please consider the following program:
Module Matrix
Sub printMatrix(ByRef mat(,))
For i = 0 To 1
For j = 0 To 1
Console.Write("{0}", mat(i, j))
Next j
Console.WriteLine()
Next i
End Sub
Sub Main()
Dim mat1(,) As Double = {{1, 2}, {2, 3}}
Dim mat2(,) As Double = {{1, -2}, {2, 3}}
Dim mat3(1, 1) As Double
mat3(0, 0) = 2
printMatrix(mat1)
End Sub
End Module
I want to pass the array mat1 to the routine printMatrix. However, when I compile the above code,
I get the following error message:
error BC30333: Value of type '2-dimensional array of Double' cannot be converted to '2-dimensional array of Object' because 'Double' is not a reference type.
I understand that Double is a value type, not a reference type but I would expect to be
able to pass a two dimensional array of Doubles. If I can, please tell me how.
Thanks
Bob
|
|
|
|
|
BobInNJ wrote: ByRef mat(,))
I don't know the syntax, but you're clearly not specifying here what sort of array you're sending, and the match in variable names is irrelevant. I expect that means it's trying to take Object by default, and it's refusing to box it for you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|