|
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.
|
|
|
|
|
BobInNJ wrote:
The default type for mat , since you didn't specify it, is Object. Your code, as written, is actually:
Sub printMatrix(ByRef mat(,) As object)
By the way, the ByRef is redundent in this case since all reference type as always bassed by, well, reference.
Your code should read:
Sub printMatric(ByRef mat(,) As Double)
|
|
|
|
|
Dave,
Thanks for the response. You solved my problem.
Bob
|
|
|
|
|
Hello every body:
How I can make a blinking Label? I know I am unclear but I don't know how I can ask! Suppose there is a label that the text of it, is a red star, like this :
' * '
I want star like a light can be on and off, on and off, on and off…
I hope, my question is understandable and clear!
|
|
|
|
|
A way that I can think of doing this is to have a timer and handle its tick event. In that event, just remove and add "*" to the label text.
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...!!
|
|
|
|
|
use a System.Windows.Forms.Timer, and in its Tick handler modify the Label properties; either Visible, or ForeColor or Text.
|
|
|
|
|
I have a function as follows:
Function XYZ As Boolean
End Function
That's right, there is no code in the function. Does it return True by default?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|