|
to audit what exactly?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
No.
If you have a specific problem you're trying to solve with YOUR code, we can help with that. If you want someone to do work for you, like Google "vb.net audit trail examples" for you, you're on your own.
|
|
|
|
|
hey guys,
i am making a programming language in visual basic and i am stuck. i would like to add these things to it:
1. i would like to add if functions "if string1 = something {
enter code here
}"
2. i would like to add parameters such as what you saw in example 1 "{enter text here}"
3. i would also like to add classes "goto finnish" and it would execute code that is in the 'finnish' class
as i said, i am using visual basic 2010 and i am making it so when you press button1; it will execute code in textbox1. eg:
click button event
for each a as string in textbox1.text.split(system.environment.newline())
if a.contains("write ")
messagebox.show(a.substring(6))
end
end
|
|
|
|
|
have you made the compiler that will interpret this new language? or are you trying to add "helping" functionality to help you with projects?
have a read of this Create a language compiler[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
i am not actually making a compiler, i am making an interpreter.
|
|
|
|
|
you will then need to look at how to make a parser as this will validate the code that you have entered
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Repost from Quick Answers. That's not good behavior.
|
|
|
|
|
When I need to do scripting I usually just use VB, and then use the VBCompiler to create the assembly.
Public Function CreateObject(ByVal code As String) As Object
Dim vbCP As New VBCodeProvider
Dim dir As String = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
Dim Options As New CompilerParameters
Options.GenerateInMemory = True
Dim cr As CompilerResults
Options.ReferencedAssemblies.Add(dir + "System.Data.dll")
Options.ReferencedAssemblies.Add(dir + "System.XML.dll")
Options.ReferencedAssemblies.Add(dir + "System.Windows.Forms.dll")
Options.ReferencedAssemblies.Add(dir + "System.Data.DataSetExtensions.dll")
Options.ReferencedAssemblies.Add(dir + "Mscorlib.dll")
Options.ReferencedAssemblies.Add(dir + "System.dll")
Options.ReferencedAssemblies.Add(dir + "System.Drawing.dll")
Options.ReferencedAssemblies.Add(dir + "Microsoft.VisualBasic.dll")
Options.ReferencedAssemblies.Add(dir + "System.Web.Services.dll")
cr = vbCP.CompileAssemblyFromSource(Options, code)
If cr.Errors.Count > 0 Then
Return cr.Errors
End If
oAssy = cr.CompiledAssembly
Return Nothing
End Function
If you get an assembly, then you can use reflection to run the new assembly.
Here's a decent article which I used when I was starting on reflection.
Reflection in .NET[^]
|
|
|
|
|
My guess is, that you are having trouble phrasing your question.
By the look of your questions, you are not making a programming language, instead you are just trying to write a program ? (and perhaps this program is supposed to do something with languages ?)
So to answer your questions:
1. Conditions in VB.NET are simple:
If string1 = "Hello" Then
Else
End If
2. You can add parameters to executing code using Subs and Functions. A Sub will simply execute whatever code you write in it, and a function is otherwise the same, but it will return a value.
Public Sub ExecuteWhenTrue(Byval Par1 as String)
MsgBox(Par1)
End Sub
Public Function ExecuteWhenFalse(Byval Par1 as String) As String
Return "You are not very polite " & Par1
End Function
If string1 = "Hello" Then
ExecuteWhenTrue("Well, hello to you too!")
Else
MsgBox(ExecuteWhenFalse("buddy"))
End If
3. Just write a Sub with the code that you want to execute at the finish (of what ?)
If you mean when the user has given all the correct parameters, then just execute the sub once all your conditions (see point 1) are true.
If you mean when you close the program, then execute the sub in the Closing or Closed event of the form.
Good luck
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
i use this way,
Private Sub Editor_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Alt AndAlso e.KeyCode = Keys.S Then
Me.Close()
End If
End Sub
is it possible to use select case?
cause i prefer that way..
|
|
|
|
|
Yes, you can use Select but for such a simple block of code there does not seem to be any real benefit.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hello can anyone help me to serializer a class with a complex property
I can't serialize a class that contains this property
Public Property DTOCarrito() As IList(Of DTOCompraCarritoX)
Get
If _DTOCarritoList.Count = 0 Then
If CuponIngresado.Trim.Length = 0 Then
CuponIngresado = String.Empty
DTOCuponDetalle = Nothing
End If
End If
Return _DTOCarritoList
End Get
Set(ByVal value As IList(Of DTOCompraCarritoX))
_DTOCarritoList = value
End Set
End Property
I can serialize fine without this property, but when I add the property and try to serialize I get this message "error reflecting type '. DTOCompraX'." DTCompraX is the main class name.
This is the code to serialize
Dim dt As DTOCompraX
Dim dtc As DTOCompraCarritoX
Dim DTOclist As IList(Of DTOCompraCarritoX)
Dim dtp As DTOTipoProducto
dtc = New DTOCompraCarritoX()
dtp = New DTOTipoProducto()
DTOclist = New List(Of DTOCompraCarritoX)
Dim extraTypes(1) As Type
extraTypes(0) = dtc.GetType()
extraTypes(1) = DTOclist.GetType()
dt = New DTOCompraX()
Dim ot As Type
ot = dtc.GetType()
Dim fs As FileStream = New FileStream("c:\miobjeto.xml", FileMode.Create)
Dim xs As XmlSerializer = New XmlSerializer(dt.GetType(), extraTypes)
xs.Serialize(fs, dt)
fs.Close()</pre>
Thank you.
|
|
|
|
|
I am not sure how to resolve that. Have you tried to use List instead of IList, i.e.
Public Property DTOCarrito As List(Of DTOCompraCarritoX)
|
|
|
|
|
Need some help out there. To give an example of my problem suppose the following...
Public Module MathHelpers
Public Function Add(ByVal param1 As Object, ByVal param2 As Object) As Object
Return param1 + param2
End Function
End Module
And you wanted to be a bit more OOP by overloading the function to prevent unboxing and boxing you decide to do this. Also, not only for the aforementioned reasons you wanted to add 2 class objects that have something specific to these class objects that can be added. But leaving the parameter data type as Object will not suffice to capture the differences between say adding 2 class objects in comparison with 2 integer types. Does that make sense?
Public Module MathHelpers
Public Overloads Function Add(ByVal param1 As Integer, ByVal param2 As Integer) As Integer
Return param1 + param2
End Function
End Module
After running into this error[^]. I am bit unsure what to do next.
Since the MSDN hints that Classes can overload functions I decided if I could create a Static Class. Since that proved pointless all I want is to overload this function without creating an instance of it.
MSDN does poor job in this scenario telling me A) Why this is not encouraged to do and B) some helpful advice on how to encapsulate my functions/routines with overloading.
Any advice you can offer I would greatly appreciate.
If you need me to clarify anything just let me know.
|
|
|
|
|
Clark Kent123 wrote: MSDN does poor job in this scenario telling me A) Why this is not encouraged to do and B) some helpful advice on how to encapsulate my functions/routines with overloading.
Try overloading with using the keyword. It'll work, and I have no explanation why.
Bastard Programmer from Hell
|
|
|
|
|
within a module you dont use the overloads keyword as Modules dont have instances.
You can achieve the two functions by
Module Module1
Public Function add(ByVal param1 As Object, ByVal param2 As Object) As Object
Return param1 + param2
End Function
Public Function add(ByVal param1 As Integer, ByVal param2 As Integer) As Integer
Return param1 + param2
End Function
End Module
the above works as you are changing the signature of the function.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Thanks Simon for that response. Very helpful. What I am having a hard time grasping is how is the compiler supposed to know that your encapsulating this?
For instance we use keywords in VB to let the compiler know what we want to achieve; Class, Module, Integer, etc. So by removing the "Overload" keyword the compiler will just "know" that I want to encapsulate a sub/function within a module?
|
|
|
|
|
as Dave stated you mainly use the overloads keyword when you are creating an overloaded method from a base class. But in the instance of creating overloaded methods in the same class or module it uses infered overloading
have a read of this I found this useful in understanding the difference Overloads keyword in VB.NET[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Thanks that does help. I just wish that MSDN document I linked to in my original post just said "Get rid of the Overload keyword and you will be all set". I guess that's just wishful thinking on my end.
I did check the link out that you posted. I will bookmark it so I don't make the same mistake twice. Thanks.
|
|
|
|
|
Anytime
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
You don't have to put the Overload keyword in there unless yuo're inheriting from a base class and overloading a base method.
You just do this in a Module and it works fine:
Public Function Add(ByVal parm1 As Object, ByVal parm2 As Object) As Object
Return parm1 + parm2
End Function
Public Function Add(ByVal parm1 As Integer, ByVal parm2 As Integer) As Integer
Return parm1 + parm2
End Function
Truthfully, I would not be using Object as one of these overloads. You're casting too big of a net catching case that you didn't overload with that one.
|
|
|
|
|
Oh
Thanks Dave for that. Since overloading is for classes and inheritance the compiler will know within a module that I am "overloading" a sub/function by just duplicating the same name sub/function, but just changing the params data types? I was always under the impression that you had to use the Overload keyword let the compiler know that you're encapsulating the sub/function.
By the way I had no intention of using the Object data type. It was the VB6 style of attempting at encapsulation even though we both know this is unhelpful in that situation.
I appreciate the advice and didn't realize my solution was that simple. Thanks.
|
|
|
|
|
Clark Kent123 wrote: I am "overloading" a sub/function by just duplicating the same name
sub/function, but just changing the params data types
Yes.
|
|
|
|
|
Hello,
I was wondering if you could programically, force/automatically pull the vertical scrollbar down, I'm using this for a chat program, and some users find it annoying, when there on chat and it scrolls completely up, each time it updates, it updates pretty much every second.
Regards,
Brandon T. H.
|
|
|
|
|
For what kind of control?? You're appending text to the bottom of a textbox or a listbox? or what?
|
|
|
|