|
well thanks everyone... I'll just have to tell him that. Thanks. Will they ever make it possible?
|
|
|
|
|
No. The purpose of one-way encryption is to make sure it is one-way. one-way, as in "there is no way back".
|
|
|
|
|
Yeah, it is possible now. Starting by researching "two-way encryption algorithms" and do not use MD5 or any other one-way hashing algorithm.
|
|
|
|
|
thebiostyle wrote: Will they ever make it possible?
Who is "they"? Evil mad scientists?
|
|
|
|
|
Smithers-Jones wrote: Who is "they"? Evil mad scientists?
I'm nOt mAD!
|
|
|
|
|
Don't despair, MD5 was cracked last year by a team of security specialists. It took them only eight days with a cluster made of 200 special made computers (Playstation3) to crack one password.
So it's not impossible, but close enough.
|
|
|
|
|
hi......
I am working on a project where i need to write a vb Script in word 2007 and also i wantto add the button in word 2007 and even for the same..
So how should i go for this????
|
|
|
|
|
Have you switched on the DEVELOPER tab?
(Jewel-Word Options-Popular-Developer Tab).
Write the script within this.
You can set it to run in ALL Docs, specific Docs etc, and to run on start or on request.
If you could specify what kind of functionality you require I could be more helpful.
To add a button, just place a shape on the page and assign a macro.
Unless you mean to add to the Ribbon, in which case download a CustomUIEditor.
Get It Here[^].
------------------------------------
No Good Deed Goes Unpunished Clare Boothe Luce
|
|
|
|
|
|
I would need to pass an array (variant) which was dimensioned and "filled" in VBScript to a com-interop-based VB.Net .dll
On the VBS side I got;
Dim DoubleArray(4) 'Fixed size array
DoubleArray(0) = 100
DoubleArray(1) = 200
DoubleArray(2) = 300
DoubleArray(3) = 400
This is purely for test purposes so don't lose it over the inefficiency of the way I did that
On the VB.net dll side I got the following property with which I tried to get the array;
Public Property DataY() As Object()
Get
Return RezultatiY
End Get
Set(ByVal value As Object())
RezultatiY = value
End Set
End Property
At first I tried declaring DataY as Integer Array and got "type mismatch" error, this was before I was aware of the fact that VBS does not deal with "type" arrays (integer array, string array), only "variant" ones. This made me try to pass it as an object...again it didn't work.
I have never before worked with VBScript (which is painfully apparent) and after having spent 2 days pouring over google search results it became self evident that the problem is not only in my lack of knowledge but also in some sort of inconsistency between array definitions in VB.Net and VBScript.
Currently I am fiddling with the following method in my COM .dll, hoping it would work;
Public Class GetArray
Public Function GetArrayPls(ByRef vntArray As VariantType)
Dim NewArray = Nothing
NewArray = vntArray
MsgBox(vntArray(1).ToString)
Return NewArray
End Function
*Any* help would be *much* appreciated.
Thanks!
|
|
|
|
|
|
Indeed, now I know even less than I did before LOL.
Progress report;
I have managed to send a simple string from VBS to NET which I can then easily delimit and fill an array with delimited elements all under .net
This works but its not what I wanted, and I get annoyed when I feel too stupid to figure something out, it gets personal at that point
I am therefore still trying to get an array across, the latest fail in the (long) row being;
<br />
Microsoft VBScript runtime error '800a01ca'<br />
<br />
Variable uses an Automation type not supported in VBScript: 'Method3'<br />
<br />
/test2.asp, line 21
Maybe I could do a "byref" to circumvent this but I don't want to use "byref".
In the meantime I have tried using "byref" just to see whether it would work, it did.
<% @Language="VBScript" %>
<% Option Explicit %>
<%
Dim rc
dim cta
dim arrayz(5)
arrayz(0) = 100
arrayz(1) = 200
arrayz(2) = 300
arrayz(3) = 400
arrayz(4) = 500
set cta = Server.CreateObject("APP.APPCLASS")
rc = cta.METHOD((arrayz))
%>
And the method being;
Public Function METHOD(ByRef arrayz) As Boolean
My.Computer.FileSystem.WriteAllText("C:\Temp\test3.txt", arrayz(2).ToString, True)
End Function
This gave a "300" in my text file.
I hate using "byref" so I would still welcome another approach to the problem.
I have also been studying the example being given here: http://www.15seconds.com/Issue/990826.htm[^]
I was able to reproduce what the author did, but he basically gave a string "a,b,c,d", then he delimited it under net and made a new array, filled it with a,b,c and then byref exported the net array to VBScript, this is still not what I need.
I simply cant believe that there is no normal and logical way of passing an array from VBS to .Net
|
|
|
|
|
hi Hrizip,
I ran into similar situation as you.
and I would like to know what the meaning of the syntax of bracketing around the array variable?
rc = cta.METHOD((arrayz))
thanks!
The UI should look beautiful, so do the coding
|
|
|
|
|
Double bracketing is not necessary, its just that I read *somewhere* that it does something, but at this point I dont remember what, and I remember that the thing works just fine with single bracketing.
Heres a code snippet to play with;
So, make a new project of type class library, make it com visible and interoperable
Paste this
Imports System.IO
Imports System.Math
Imports System.Object
Imports System.Threading
Imports System.Runtime.InteropServices
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices.RegistrationServices
Imports System.Xml
Imports System.Xml.XPath
Public Class Class1 ' Main Class, declared as *com interopable*, type of project : "type library", meaning it will need to be registered in windows, and type library will need to be exported
' you wlll need to make a batch file with the following commands in it, to check whether it has been introduced into the global assembly cache, browse your hard drive
' to windows/assembly and look for an entry named "Test", if it *is* listed there, then it will work.
'regasm Test.dll
'regasm Test.dll /tlb:Test.dll
'regasm Test.dll /codebase /tlb:Test.dll
'gacutil /i Test.dll
' Put it into the folder where you already put test.dll, along with *regasm.exe* and *gacutil.exe* (obligatory) and then execute the bat file
' The type library is now registered and you can call its methods (the only working method is called "Method1")
Public Shared RezultatiY ' vb.NET array to hold our data
Public Function MethodNumber(ByRef numberz) ' Fetch the array of type integer or double (will be converted to double)
RezultatiY = Nothing
Dim Arrayzz() As Object
Arrayzz = Nothing
Arrayzz = numberz
Dim NumberOfElements As Integer = UBound(numberz) - 1 ' We need to find the total number of elements
ReDim RezultatiY(NumberOfElements) ' And then redimension our array to that number of elements
For i As Integer = 0 To UBound(Arrayzz) - 1
Dim Temp As Double = CDbl(Arrayzz(i))
RezultatiY(i) = CDbl(Temp)
My.Computer.FileSystem.WriteAllText("C:\Temp\TestingIntegersAndDoubles.txt", RezultatiY(i) & " " & i & " " & " " & RezultatiY(i).GetType.ToString & vbCrLf, True)
Next
End Function
Public Function MethodString(ByRef Words) ' Fetch the array of type string
RezultatiY = Nothing
Dim Arrayzz() As Object
Arrayzz = Nothing
Arrayzz = Words
Dim NumberOfElements As Integer = UBound(Words) - 1
ReDim RezultatiY(NumberOfElements)
For i As Integer = 0 To UBound(Arrayzz) - 1
Dim Temp As String = CStr(Arrayzz(i))
RezultatiY(i) = CStr(Temp)
My.Computer.FileSystem.WriteAllText("C:\Temp\TestingStrings.txt", RezultatiY(i) & " " & i & " " & " " & RezultatiY(i).GetType.ToString & vbCrLf, True)
Next
End Function
Public Function MethodChars(ByRef Characters) ' Fetch the array of type characters
RezultatiY = Nothing
Dim Arrayzz() As Object
Arrayzz = Nothing
Arrayzz = Characters
Dim NumberOfElements As Integer = UBound(Characters) - 1
ReDim RezultatiY(NumberOfElements)
For i As Integer = 0 To UBound(Arrayzz) - 1
Dim Temp As String = CChar(Arrayzz(i))
RezultatiY(i) = CChar(Temp)
My.Computer.FileSystem.WriteAllText("C:\Temp\TestingChars.txt", RezultatiY(i) & " " & i & " " & " " & RezultatiY(i).GetType.ToString & vbCrLf, True)
Next
End Function
End Class
Public Class Method2 ' This is used for strings ( completely untested at this point )
Public Shared RezultatiYP() = Nothing
Dim NoviArray = Nothing
Dim intColumns As Integer, intCnt As Integer, intPos As Integer
Dim i As Integer, j As Integer, n As Integer
Public vntTemp As Object
Dim strTemp As String, chrTemp As String
Const vectorSize As Integer = 10
Public Function ConvertToArray(ByVal strParse As String, ByVal strDelimiter As String, ByVal intDimensions As Integer, ByRef vntArray As Object) As Integer
' Metoda za preuzimanje stringa iz VBS-a, delimitacija po znaku ",", stvaranje novog arraya, punjenje istog clanovima starog array-a.
' loop for number of instances of the delimiter and store it in an array for later use.
ReDim vntTemp(vectorSize)
n = 0
For intPos = 1 To Len(strParse)
chrTemp = Mid$(strParse, intPos, 1)
If Mid$(strParse, intPos, 1) = strDelimiter Then
intCnt = intCnt + 1
FillAndSize(n, strTemp, vntTemp)
strTemp = ""
n = n + 1
Else
strTemp = strTemp & chrTemp
End If
Next
FillAndSize(n, strTemp, vntTemp)
ReDim Preserve vntTemp(n)
' redim the array (deprecating by 1 for base zero array) by row and column
intColumns = (intCnt + 1) / intDimensions
intDimensions = intDimensions - 1
intColumns = intColumns - 1
ReDim vntArray(intDimensions, intColumns)
' populate the newly redimensioned array
n = 0
For j = 0 To intColumns
For i = 0 To intDimensions
vntArray(i, j) = vntTemp(n)
RezultatiYP(n) = vntTemp(n)
n = n + 1
Next
Next
End Function
Private Sub FillAndSize(ByVal intCount As Integer, ByVal strTemp As String, ByRef vntInput As Object)
Const vectorSize As Integer = 10
Dim i As Integer
i = intCount Mod vectorSize
If i = 0 And intCount >= vectorSize Then
ReDim Preserve vntInput(intCount + vectorSize)
End If
vntInput(intCount) = strTemp
End Sub
End Class
Compile it, you will get a dll, then regasm and gacutil it to enter it into GAC
Start IIS, point it to a default document test.asp and paste the following into it:
<% @Language="VBScript" %>
<% Option Explicit %>
<%
dim cta
set cta = Server.CreateObject("Test.Class1")
dim arrayz(8)
arrayz(0) = 5
arrayz(1) = 6
arrayz(2) = 7
arrayz(3) = 8
arrayz(4) = 9
arrayz(5) = 8
arrayz(6) = 7
arrayz(7) = 6
dim arrayz3(8)
arrayz3(0) = "C"
arrayz3(1) = "H"
arrayz3(2) = "A"
arrayz3(3) = "R"
arrayz3(4) = "a"
arrayz3(5) = "c"
arrayz3(6) = "t"
arrayz3(7) = "r"
dim arrayz2(8)
arrayz2(0) = "Today"
arrayz2(1) = "is"
arrayz2(2) = "A good Day"
arrayz2(3) = "To Die"
arrayz2(4) = "Tomorrow"
arrayz2(5) = "Glad"
arrayz2(6) = "Nothing"
arrayz2(7) = "Testing"
cta.MethodNumber(arrayz)
cta.MethodString(arrayz2)
Cta.MethodChars(arrayz3)
Response.Write Server.HTMLEncode("()")
%>
Browse it, and in the folder C:\temp\ you will find 3 files showing that arrays were successfully received from VBS into vb.NET
|
|
|
|
|
Hey Hrizip,
Thanks for the detailed reply. I googled a bit and found that the bracketing means forcing VBscript to pass the array by value rather by reference.
And may I know which framework version you are using? We came across this post http://connect.microsoft.com/VisualStudio/feedback/details/331632/marshaler-bug-with-vbscript-arrays[^] and the guy commented that the problem (passing array from VBscript to .NET DLL thru COM) is only solved in .net framework 4.0.
Thanks!
The UI should look beautiful, so do the coding
|
|
|
|
|
|
It is difficult to say at this point which framework we were using at that point, chances are we were using 3.5.
We are still mostly using 3.5, only several machines have 4.0 installed.
Thanks for the info on double bracketing, I remember going through hell and trying every possible thing to make this work, I havent commited to memory all those trials (and errors).
Kinda not surprising that there is/was a bug in the framework itself, that would explain a great deal of things.
The whole process of interoping with legacy apps is just horrible, making it work gulps down 80% of total time spent developing an app.
Similar problems happen when you have to cross the managed/unmanaged barrier between apps, and between various C languages.
I remember going thru hell trying to adapt c++ code to vb.net code across managed/unmanaged barrier. It also has problems marshalling various data types, and its also "trial and error" until you find the right combination.
|
|
|
|
|
I have two label1 and label2 on form by default label2.visible=False. when mouse move on label1 then label2.visible=True, else if mouse is not on label1(or over any other control) then label2.visible=False
what should i do to set visibility of label2 to False if mouse is not over label1, help please
|
|
|
|
|
You can use the MouseEnter and MouseLeave events of Label1 and set Label2.Visible = False / True as appropriate.
|
|
|
|
|
there isn't any MouseEntry or MouseLeave events with label1 or 2.
i am using vb6
|
|
|
|
|
You should have mentioned you were using VB6 in your original post. If you don't, everyone assumes you're using VB.NET.
There is no equivilent event in VB6. The closeest you're going to get is MouseMove, but you cannot tell if the mouse has left the label control, only when the mouse is moving on the label control.
|
|
|
|
|
Well I didn't know that did I!
I don't have VB6 on any of my machines here at the moment, so can't look, but does the form have a MouseMove event? if so, you could use this in some way.
|
|
|
|
|
Tufail Ahmad wrote: there isn't any MouseEntry or MouseLeave events with label1 or 2.
There's a MouseMove that get's triggered when the mouse moves over the label - you could abuse that to simulate the events. Add a boolean value, and set it to "true" the first time that the MouseMove event fires. That would be the equivalent of a MouseEnter event.
Clear the boolean again when there's a MouseMove on the main form, or if you didn't receive a MouseMove in the last two seconds; that's your MouseLeave event
I are Troll
|
|
|
|
|
I have a project where I am converting a very complex MS Access front end to a VB.Net application. There are close to a hundred tables in a SQL database containing mostly but not completely static data that I plan on turning into individual classes.
So for each class I have a strongly typed dataset for per table, and a class. Each table has an ID (IDENTITY) field as a unique key. What I am wanting to do is have a generic way of populating and updating each of these classes. Here is what I have so far.
First I created a new Attribute class
<AttributeUsage(AttributeTargets.Property, Allowmultiple:=False, Inherited:=True)> _
Public Class DataTableSourceAttribute
Inherits System.Attribute
Private _dataTableField As String
Public Sub New(ByVal DataTableField As String)
_dataTableField = DataTableField
End Sub
Public Property DataTableField() As String
Get
Return _dataTableField
End Get
Set(ByVal Value As String)
_dataTableField = Value
End Set
End Property
End Class
Then in my class I use this to flag each property with the field that is associated with it in the database (the database is close to 10 years old and has no naming conventions whatsoever).
Imports System.Reflection
Public Class TransportMethod
Implements IEquatable(Of TransportMethod)
Private _code As String
Private _iD As Integer
Private _description As String
Private _requiresAttendant As Boolean
Public Sub New(ByVal row As dsTransportMethod.dtTransportMethodsRow)
ProcessRow(row)
End Sub
<DataTableSource("TransportMethod")> _
Public Property Code() As String
Get
Return _code
End Get
Protected Set(ByVal value As String)
_code = value
End Set
End Property
<DataTableSource("TransportMethodDesc")> _
Public Property Description() As String
Get
Return _description
End Get
Protected Set(ByVal value As String)
_description = value
End Set
End Property
<DataTableSource("TransportMethodID")> _
Public Property ID() As Integer
Get
Return _iD
End Get
Protected Set(ByVal value As Integer)
_iD = value
End Set
End Property
<DataTableSource("RequiresAttendant")> _
Public Property RequiresAttendant() As Boolean
Get
Return _requiresAttendant
End Get
Set(ByVal value As Boolean)
_requiresAttendant = value
End Set
End Property
Finally, here is the code to populate the class.
Private Sub ProcessRow(ByVal Row As dsTransportMethod.dtTransportMethodsRow)
Dim PropertyList As PropertyInfo() = CType(Me, Object).GetType.GetProperties(BindingFlags.DeclaredOnly Or BindingFlags.[Public] Or BindingFlags.Instance)
For Each objProperty As PropertyInfo In PropertyList
If objProperty.CanWrite Then
Dim oAttribs() As Attribute = CType(objProperty.GetCustomAttributes(GetType(DataTableSourceAttribute), True), Attribute())
If oAttribs.Length = 1 Then
Dim field As String = CType(oAttribs(0), DataTableSourceAttribute).DataTableField
CType(Me, Object).GetType.GetProperty(objProperty.Name).SetValue(Me, Row(field), Nothing)
Debug.Print(field)
End If
End If
Next
End Sub
End Class
My question (finally) is: Is there a simpler or better way to accomplish what I am trying to do? This will be a very long project, and I while I can add new functionality, I cannot break anything in the current system. I still need to write the generic code to persist the data back to the SQL DB.
Thanks.
|
|
|
|
|
If you are going to take the time to build new classes for each of your tables, then why are you trying to come up with a generic way of accessing the data ? You are willing to commit the time to create classes, so why don't you take advantage of .NET and write each class specifically for each table ? In the long run, won't you be better off ?
Research the topics of DAL (data access layer) and you will get a better idea of how to build an interface to your data.
This article has some really good points ...
Building an N-Tier Application in VB.NET, in 8 Steps[^]
Don't make things harder than they really are
Good luck.
|
|
|
|
|