C# - DebuggerDisplayAttribute - How Does It Choose The Language When Evaluating Expressions
Sep 22, 2009
[URL]From what we can see on MSDN, it says to be careful about which expressions we put as they change from language to language. My question is: what are the supported languages for writing those expressions? If various languages can do it, how does it detect which language is being used?I've made my class in CLI, and coded the expression in c#, being that it works. I've tried in c++/CLI, but that way it doesn't.
Here is my code:
[DebuggerDisplay("z = {ToString()} Norm = {System.Math.Round(Norm,2)} Angle = {System.Math.Round(Angle, 2)}")]
Now, trying it the c++/CLI way:
[DebuggerDisplay("z = {ToString()} Norm = {System::Math::Round(Norm,2)} Angle = {System::Math::Round(Angle, 2)}")]
My assumption is that it will always read the expression as c# code. Is this true?
View 2 Replies
ADVERTISEMENT
Nov 19, 2010
Just switched over from VS2005 to VS2010 and I am having issues debugging my software. When I stop at a breakpoint, I can't see what variables contain. When I try to look at variables with QuickWatch, it states that it is "Unable to evaluate expression."
View 3 Replies
Jul 18, 2010
Which language, VB.Net or C# is the best language to choose for development right now? Needing users to have the .Net framework is something that I see as a drawback to Vb.NET, but what are the pro's and con's of each language? What can be achieved with one but not the other?
View 1 Replies
Jun 27, 2012
We are currently hiring at the company where I work, and here the codebase is in VB.Net.We are worried that we miss out on a lot of brilliant programmers, who would never ever consider working with VB.Net.
My own background is Java and C#, and I was somewhat sceptical as to whether it would work out with VB, as - to be honest - I didn't care much for VB.
After a month or so, I was completely fluent in VB, and a few months later I discovered to my surprise, that I actually like VB. I still code my free time projects in C# and Boo though.
So my question is firstly, how important is language for you, when you choose a new programming job?
Lets say if its a great company, salary is good, and generally an attractive work-place. Would you say no to the perfect job, if the language wasn't your preferred dialect?VB or C# is one thing, but how about Java or C# etc.Secondly if the best developers won't join your company because of your language or platform, would you consider changing, to get the right people?
View 26 Replies
May 31, 2012
I would like to learn a new programming language to be able to compile the same code for different platforms.
My background in programming: VB.NET (I have been using it as my main language for the past 3 years), some Java (to which I couldn't really adapt) and very limited PHP. I use a Mac Book with OS X to code.
I'd like to find a PL with a very easy learning curve from VB.NET, cross-platform IDE and able to compile the same for Windows, Mac and Linux.
I am a beginning programmer, so a object-oriented, .net like language is probably my best bet.
View 2 Replies
Nov 20, 2011
How can I make something like this: I have now made everything in Finnish but Id like to add English too. So it must chage everything (labels, menus, checkboxes, tooltips, etc) but the contents of program is the same. And compobox isnt necessary if there is easier way to do this. I just like to have "start" window to choose language.
View 2 Replies
Mar 29, 2010
In my winform app in VB.NET I want to use the localization option. But i have a few questions/problems. I'm using a menu strip to select an other language. But it seems that is doesn't change my menustip text to my selected language. It does change my labels, buttons, and textboxes but menu strips don't seem to change when I choose another language. Also is it possible to get those resx files such as MyForm.fr-FR.resx compiled so it isn't an external file outside my app? Or to get those files in an Language folder at the same location of my app, so i don't have all those fr-FR & nl-Nl folders in the same location as my program?
View 4 Replies
Dec 20, 2011
I am currently working on a family project which is based on "Who Wants To Be A Millionaire?" show. There is a huge diffrence between the show and my project. My project is a christmas edition and the goal is not to get money or something, since I will not add it... Erhmm... Let me get to the point. I have already designed a layout and scripted some things. I have about thirty questions but I do not want them to always spawn in the same array, if you know what I mean. I want the program to randomly choose one of those thirty questions and NEVER choose the same question in the same program run. By the way, there are four options on my project: A, B, C and D. I have got everything, I just need a code.
View 3 Replies
Dec 2, 2011
So I am trying to evaluate 3 conditions in an if statement. Its not working how I would assume it should. I basically want to do this:vb.net If PGN = &HEF007E And PGNData(0) = &H58 And (PGNData(1) And &H40) = &H40 Then IgnOn = True Else IgnOn = False If I write it in that manner it gives inconsistent results. If I workaround by writing it this way it works perfectly:vb.net If PGN = &HEF007E And PGNData(0) = &H58 Then If (PGNData(1) And &H40) = &H40 Then IgnOn = True Else IgnOn = False
View 1 Replies
Mar 11, 2010
What reasons are there to migrate from vb.net specific language to .net framework language?
Examples:
VB.net
ubound
msgBox
.Net Framework
array.getUpperBound(0)
messageBox
View 4 Replies
Feb 17, 2010
Does anybody know of a call in vb.net that will evaluate a string expression. For example, how would one evaluate the expression "(1+2)*(3+4)"?I've looked all over and it seems that people are writing their own parsers. There has to be a better way. After all these years, VB.Net must have something that will take an expression and evaluate it.
Dim strMyExpression as string = "(1+2)*(3+4)"
msgbox( VBEvaluate(strMyExpression))
and the result would be 35.Also, when will microsoft start to use google as the search engine for these forums? Bing really sucks. Searching for "Evaluating a string expression in VB.net" gives the most bizarre links.
View 7 Replies
Aug 26, 2011
My DGV's last visible column in a boolean. I am needing to go through each row and determine if the value of dgv item bFlag is true then turn the row back ground red. Here is my start of it. It appears to be only making one loop then giving the message box.
Private Sub EvalGrid()
BindDGV(dgvResults)
Dim cnt As Integer = dgvResults.Rows.Count
[Code]....
View 9 Replies
Nov 18, 2010
I am trying to figure out a way to set a string equal to vb code and then run that string as a line a of vb code.
for example
set string x = "TextBox1.Text =
"test1".ToString"
[code]....
View 4 Replies
Aug 27, 2009
I have a application that allows the user to enter a series of nested filtering commands. E.g "Name starts with x or ((Description contains y or Property1 is On) and Property2 > 100)"
I can preprocess this and distill it down to a string in the form of an expression of True and False's ie, To "True or ((False or True) and False)" Is there a simple way to have this final expression evaluated without having to write a complex evaluator myself?
I have seen a method of evaluating this by compiling a dummy function at runtime but as I need to process this against possibly thousands of records that solution is too slow.
BTW These are not all fields in a database so I cannot use Queries or SQL etc.
View 2 Replies
Jun 19, 2009
I store a formula in the database such as the following:GrossIncome+(Overtime/0.5)-Deductions=BasicNetIncome
I am able to substitute the string representations with actually values entered, thus:1000+(150*0.5)-100=BasicNetIncome
Then I remove the '=BasicNetIncome', thus:
1000+(150*0.5)-100
How can evaluate the above equation to return a result:
[Code]...
View 1 Replies
Dec 5, 2010
I'm working on a project where I need to evaluate some formulas in VB.NET. I've been using the MS Script Control to evaluate some of the simple logical/mathematical formulasHowever, I'm now faced with dealing with string expressions that set variables in my program to certain values. So, for example, let's say I've got the following:
Dim netPrice As Decimal
Dim expressionFormula As String = "netPrice = 0"
[code]....
View 3 Replies
Jul 7, 2011
Is there a method that allows me to evaluate a mathematical expression in a string? Example (Not actual Code):
Input = "2+2"
Output = SomeMethod(Input)
Output = 4
Update: Nevermind, I found a way around it by using DataTable.Compute.
View 1 Replies
Apr 4, 2011
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
With Me.PrintForm1
[Code]....
View 6 Replies
Jun 14, 2011
I'm looking to create an inline function (method) inside my NVelocity template. The solution to this appears to be to use Velocimacros. So, I mocked up the following template to test:
#macro( getOutput $one $two $three )
<td>$one</td>
<td>$two.Item2</td>
<td>$three</td>
#end
[Code] .....
When I run the template, the problem I'm having is that the output from the macro parameter $three is literally "$item.Item3" instead of evaluating to #3/3/2003#. (BTW - this happens with any of the 3 items in the tuple if they are passed with the .Item call, so it isn't about the data type). I can make a variable and pass it just fine ($one1). I can pass the tuple itself and call the .Item property inside the macro ($item.Item2), but for some reason I cannot call the .Item property when passing the argument to the macro.
View 1 Replies
Apr 8, 2009
We are working on a poker game as a class project. My part is to evaluate and then determine the value of a players hand. We are evaluating from highest to lowest (ie. determining whether the player has a straight flush, 4 of a kind, full house, flush and then going all the way down to a high card only "worthless hand"). My part is evaluating the 2 pair, 1 pair, and nothing hands. The hand will be a two-dimensional array with the row(0 thru 12),column (0) containing the numeric "face" value of the cards and the column(1) containing the value assigned to the suite (1=clubs, 2=diamonds,3=hearts,4=spades). I have NO IDEA where to even begin this evaluating procedure.
View 4 Replies
Apr 16, 2010
I am making a checkers program and I am in the phase of starting to evaluate jumps. This is what I currently have so far and allow me to fill you in a bit before you look at the code. Checker pieces are white/green. Each checker is created as a label at runtime and in the tag property a struct is held that possesses all of the information reguarding current and previous checker state.
The problem I am having is that as this sub runs each opposing checker is evaluated for jump capabilites which is all fine and dandy. It is even alright that currently if a jump is executed that the same side will continue to evaluate through the sub looking for additional jumps and if they are found they will be made because that is how it is currently coded. What I am trying to do is find a way to evaluate each piece that can jump. So if checker1 can only make one jump and checker2 can make a triple jump checker2 needs to be the guy making the jump and I honestly don't know how do start that. I am forseeing global vars being created to hold information or even a structure and taking the one that changes the most. If two checkers can only make 1 jump then I will rand the one that gets to jump (not looking to win any awards for AI here). Anyhow, any suggestions on how to start this, at least saving the information throughout the sub even if it is called recursively?
[Code]...
View 4 Replies
Apr 5, 2012
I'm working with visual studio 2008 developing software for windows CE 6.0, compact framework.I'm having this "strange?" trouble with isNumeric method. Is there another better way to do this job? Why is getting me an exception? (two in facts...both of type FormatException)
dim tmpStr as object = "Hello"
if isNumeric(tmpStr) then // EXCEPTIONs on this line
// It's a number
else
// it's a string
end if
View 2 Replies
Jul 11, 2011
I have an EnumerableRowCollection that looks like the following:
VendorCode | GroupType | Variance
01165 G .16
01165 G .16
01165 CH .16
01165 CH .18
07754 G .25
07754 G .25
07754 G .39
Essentially, this is a massive list of vendor codes, their groups, and price variances. I need to compose a query that will create a distinct list vendor codes and group types. The catch, however, is that I need to evaluate all of the variances associated with that particular VendorCode/GroupType to see if they are all the same - it they are not, I need to return some way of signifying that the group has a "custom" variance, otherwise it needs to return the value (ie: if they are all .16, then return .16, if there are multiple values, return "custom")
The result would look like this, based off of the list I showed above.
VendorCode | GroupType | Variance
01165 G .16
01165 CH custom
07754 G custom
I have no trouble getting a distinct list of VendorCode/GroupType - this is what I have so far:
Dim distinctList = From q In query Select q.VendorCode, q.GroupType, (evaluated q.Variance here?) Distinct
(where "query" is an EnumerableRowCollection(Of (anonymous type)))
I'm at a loss, though, on how to evaluate the variance property to get the result that I need?
View 1 Replies
Nov 29, 2010
I have multilingual application that was done in VB2005.We recently had a request to translate the application to Arabic (Egypt), so I have been happily running through all of the forms and changing the layout for Right to Left format.I have 2 forms that are problematic though.On one form, whenever I select Arabic (Egypt), it will automatically switch the selection to Arabic (Saudi Arabia) and try to add an ar-SA resx file.On the other problematic form, if I choose Arabic (Egypt), the IDE will automatically select Chinese (People's Republic of China), then copy the contents of my ar-EG resx file into the zh-CN file, overwriting all of our Chinese translations and layout changes with the Arabic ones.
View 1 Replies
Jul 2, 2009
I am working on a poker game and I have the game setup the way I want it in terms of graphics and I have the code programed to deal the cards out exactly how I want them. Granted, the code is very simplistic, but functional for a new programmer like myself. I'm sure there are other more efficient ways to code my game, but I like mine so far because I can at least understand the majority of it. With that being said, here are a few problems and questions that I have.
1. How come when all 12 cards are dealt out I have some cards repeating in the game? For example, I get queen of diamonds in more than one picture box when I only want the card to be dealt once and then removed until the next game.
2. I was hoping to have a button 3 to clear all the boxes, basically resetting the game to the next game. When I hit button 3 it only clears the contents of picturebox 10 and 12.Other notes: I have the deal down the way I want it. It deals the first 10 picture boxes and a second button deals the 11 and 12 picture boxes.
3. I know this is my next step so I want to post it with the code I currently have. I want to start taking my project one step further by evalutating each of the three rows of cards (3 rows of 3 cards each - I'm not worried about the dealers hand (picture box 10, 11, 12 yet). So I want to evaluate a row of pictureboxes against a "pay scale" and display the win in a text box or label next to the 3 card hand. For example, Q of diamonds, Q of Clubs, Q of spades would win 15, etc. ( have a weird feeling I may have to change the names of the cards (I have them named card1, card2, etc. right now) to something that identifies them in order to evaluate the hands.
Here is the code that I currently have. I'm using visual basic.
Public Class Form1
Dim Rndm As New Random
Dim myPB(11) As PictureBox
Dim HiddenCards As New List(Of String)
[code]....
View 1 Replies
Nov 11, 2009
I see lambda expressions have become a very useful tool at some points in the language. I've been using them a lot and most of the time they fit really nice and make the code shorter and perhaps clearer.
Now.. I've seen some , I would say excessive use of them. Some people like them so much that try to use them everywhere they can.. Some times the C# code looks like a functional language. Other factors against are the cost using reflection by lambda and that not friendly to debugging.I would like to hear opinions about how good and how code clear it is to use more or less the lambda expressions. (this is not the better example, but let's say it was the trigger)I was writing the following code. The use of the delegate { return null; } helps me avoid having to ask if the event is null or not every time I have to use it.
public delegate ContactCellInfo.Guest AddGuest();
public event AddGuest GuestRequest = delegate { return null;}
Im using resharper and the wise resharper( even it some times literaly eats the memory) made me the following suggestion
public delegate ContactCellInfo.Guest AddGuest();
public event AddGuest GuestRequest = () => null;
At my point of view the code using the delegate looks clearer. I am not against the Lamdba expression just would like to hear some advices on how and when to use them.
View 1 Replies
Jan 4, 2010
if i do not need to evaluate all the expressions, am i right to say that there are benefits and no disadvantages of using AndAlso compared to using And
example:
if a=b And f=g And y=k
can be better done with:
if a=b AndAlso f=g AndAlso y=k
View 22 Replies
Jan 20, 2010
Functionally, is there any difference (apart from syntax onbviously) between lambda expressions in C# and VB.Net?EDIT: following up on CraigTP's answer: any references to the situation in .Net 4?EDIT: I'm asking because I'm used to C#, but for a next project the customer asks VB.Net. We're not a priori against that. We realize that most language constructs are supported in both languages. However, we're particularly fond of the way C# implements lambda expressions. We would like to have an overview of the differences with VB.Net
EDIT: accepted CraigTP's answer for pointing out what I currently consider the most important difference.
So to summarize: VB.Net 9 does not support multiline statements in a lambda expression, and a lambda must always return a value. Both of these issues are addressed in VB.Net 10
View 5 Replies
Apr 25, 2012
I wish to incorporate general expressions in my Visual Basic work.Other than the basic inputting "Imports System.Text.RegularExpressions", I have no idea how to do put general expressions in my VB project.However, I can create the expressions (so, all is not lost).
View 1 Replies
Feb 20, 2011
The expression 3>6 AndAlso 7>4 evaluates to
A. True B. False
The expression 4>6 OrElse 10<2*6 evaluates to
A. True B. False
The expression 7>=3+4 OrElse 6<4 AndAlso 2<5 evaluates to
A. True B. False
View 4 Replies