|
Thanks for the input. I'm doing this more to experiment with Reflection than actually creating a custom debugging system. It just seems that there ought be be a way to get the name of a variable, as well as the value, other than passing them both as arguments, like this:
LogVariable("VarName", VarName)
But I guess not.
--Clay
|
|
|
|
|
Yes, I fully agree, in C# that is the one thing I miss most from C's pre-processor,
where you could create a one-argument macro that uses it twice, once for the name, once
for the value.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
One major problem with that approach is that the LogLocalVariables method doesn't get references to the local variables at all. What it gets is references to two newly created objects on the heap, that contains copies of the values that the local variables had when calling the method. There is no association at all between those object and the local variables, so it's impossible to use the references to get any information at all about the actual variables.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
One major problem with that approach is that the LogLocalVariables method doesn't get references to the local variables at all.
Yes, I understand that the arguments should have at least been passed as ByRef, which would have given the called sub at least access to the same memory location. Just an oversight. But even if the args are ByRef, there's no way to get the names of the passed variables.
Thanks for your comments.
--Clay
|
|
|
|
|
If I Understand your request clearly, here is how I did this
Dim objDict
objDict = CreateObject("scripting.dictionary")
Dim Var1 As String = "ABC"
Dim Var2 As Integer = 1000
objDict.Add("var1", Var1.ToString)
objDict.Add("var2", Var2.ToString)
Dim I As Integer
For I = 1 To objDict.Count
Debug.WriteLine(objDict.Keys(I - 1) & "=" & objDict.Items(I - 1))
Next
hth
Samir R. Ibrahim
|
|
|
|
|
Hi, Samir.
Thanks for the code. You're still kind of doing what I was trying to get around, though, which is having to pass both a variable name and its value to a method. I'd like to be able to get the variable name from the variable itself, much as you can do using Reflection on a method's parameters.
Still, I appreciate your efforts. I'm amazed at the number of quick and intelligent responses I've gotten to my question. This has been my favorite site for sample code for a long time, and now I see that the forum is just as good.
Thank you all!
--Clay
|
|
|
|
|
Hi Clay,
You are very welcome.
I don't know if your question is being answered, I am still don't know how to consider a post is solved.
but any way, check this, which is being considered as a answer to a problem similar to yours. in C#
http://www.west-wind.com/Weblog/posts/256.aspx[^]
Samir R. Ibrahim
|
|
|
|
|
Hello friends,
In my MS Access, one of my form having a combobox whose row source is a query data. How can i delete all items from comboBox
Thanks and regards
Jishith
|
|
|
|
|
combobox1.DataSource=Nothing
|
|
|
|
|
ComboBox1.Datasource is not showing in my access.
In ComboBox1 properties, rowsource type is Query/table and row source is my query. its not value list
|
|
|
|
|
So your Combo box is in access not in VB.Net? Is this a VBA question or an Access question or...
perhaps you can be just slightly more specific??
|
|
|
|
|
Ya . Its in MS Access.
In properties
CmbFromDate.RowSource type = Table/Query
CmbFromDate.RowSource = "Query Created On"
The query is getting for the dates from Access Table
The combo box i used for the user to select the date.
After quitting the application the .mdb file showing huge size . The previous query data is still in the combo Box
|
|
|
|
|
|
how to shift the bit in hex?
|
|
|
|
|
A hexadecimal representation of a number is text, and you can't shift any bits in text.
Perhaps you actally mean bit shifting a number? You should specify what it is that you want to bit shift, and how. Perhaps even some background to what it is that you are trying to do, so it's possible to determine if bit shifting is actually what you should use.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Multiply or divide by a power of 2 as appropriate.
That's essentially what left and right shift do.
Of course this does not allow you to control fill bits inserted when you do a right shift.
|
|
|
|
|
Please, how to add controls to a layered window? I have create layered window by inheriting from System.Windows.Forms.Form, set it up from CreateParams using WS_EX_LAYERED
25160506848319
|
|
|
|
|
It's no different that any other window. Drag the controls onto the form and drop them...
Or did you not even try to do that??
|
|
|
|
|
Hi Alls,
I'm really need help from you all, actually i already make connection into the oracle database and it successful, i can display the item such as name , id in textbox. But my problem is the image cannot display into my picutrebox......how to do that?....the table is UMP and the column of image in byte array is PICTURE....anyone can help me?....
|
|
|
|
|
A byte array can't be displayed as an image. Create a MemoryStream from the byte array, and load the image from the stream.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Can u give me sample to do memorystream?...really2 need help
|
|
|
|
|
I'm working on some code generation and I want to support VB.net as well as C#, just because I'm a nice guy.
I don't know VB.net (at all), so I just want to get confirmation or corrections on this attempt at a translation:
(Nevermind the format and fully-qualified names, that's just the way I roll.)
-- C# --
namespace Foo
{
partial class Bar
{
[System.FlagsAttribute()]
public enum Fizz : int
{
[System.ComponentModel.DescriptionAttribute("The sound a bee makes")]
Buzz = 0
}
}
}
-- VB --
Namespace Foo
Partial Class Bar
''' <summary>Just an enum</summary>
<System.FlagsAttribute()>
Public Enum Fizz As Integer
''' <summary>The sound a bee makes</summary>
<System.ComponentModel.DescriptionAttribute("The sound a bee makes")>
Buzz = 0
End Enum
End Class
End Namespace
Does this seem essentially correct? Have I made a horrendous mistake or perhaps a minor typographical error?
|
|
|
|
|
Hi PIEBALD,
if you create a code generator, it might be wise to present the output to an actual compiler,
rather than asking here on a forum. If you don't have VB.NET yet, there is the same Express
edition as for the other .NET languages, you can download it freely and be up and running in
a matter of minutes.
Maybe, not sure, maybe the VB.NET compiler itself is simply part of the .NET framework and
you could invoke it directly, no VS Express required.
Make sure to use the fully qualified path as in C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yeah... I coooouuuld...
I was just hoping to get a thumb up or down before I progress to that point.
|
|
|
|
|
Always there to help:
BTW: does it work for more than one enum value too?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|