Equal Button: 9x9=81=729?
Feb 6, 2010On winxp sci. calculator when you press 9x9=81 you get 729 when you press = again.How can i add this feature to this code i already have.
View 2 RepliesOn winxp sci. calculator when you press 9x9=81 you get 729 when you press = again.How can i add this feature to this code i already have.
View 2 RepliesI have a form that I am adding a set of buttons to. I am adding an event to those buttons. I need this event to function slightly to determine what button was pressed.
I need the button to simply set a string variable equal to the clicked buttons text so I can determine what button was pressed.
How can this be accomplished?
''Adding the buttons''
For Each dr In dtMenus
Dim strMenuName As String
strMenuName = dr.Item("strMenuName").ToString
[CODE]...
In the following LINQ query, i would like when the Loc=Locale.Gr all the records with GrID=100 returned and when the Loc is anything else all the other records with GrID <> 100 returned.How can i achieve this one? I tried something like the following, but it is totally wrong.
PrivateSub Test(Byval Loc as Locale)
Private Const GrID as integer = 100
Dim Query = From c In Mob Where c.CountryID = IIf(Loc = Locale.Gr, GrID, <> GrID) select c
End Sub
[Code]...
How does one check to see if the system time is equal or not equal to a specific time? So, say I want to perform an action if your system time is between 6pm and 6am. Or something similar?
View 1 RepliesYesterday I asked why a adding 10 times 0.10 to a double is not equal to int 1;in VB Why (1 = 1) is False.I got an excellent answer. The overview is because:Floating point types and integer types cannot be compared directly, as their binary representations are different.The result of adding 0.1 ten times as a floating point type may well be a value that is close to 1, but not exactly.I can see the reason why now. However, if I do something like:[code]In this case I really obtain equality between double 1.0 and int 1. I thought then that double were only approximations so I would expect d to be somehow a value close to 1 as in the original first question. Why is not a good idea to compare directly different data types (in this case double - integer) and why I this time I obtain equality ??
View 2 RepliesI have a Date variable startdt and a String variable hdnsdate. Suppose if startdt has the value in the form 3/1/2012 and hdnsdate has the value in the form 03/01/2012. Than how can i compare that these two dates are equal in vb.net. In if condition of my program i want to do this check. In case the two dates match move out of if loop otherwise go into the if loop. E.g A sample in C# what exactly i want.
[Code]....
I'm a little foggy on System.Type versus an actual class type (like Object or XmlDocument) in .NET... will this code correctly determine if the type of a particular object is equal to a class I specify?
// Given "myObject" (unknown type), and some class type (let's say "MyClass")...
If myObject.GetType.Equals(MyClass)
If TypeOf(myObject) Is MyClass[code].....
Which one is correct? Bonus points if you can provide some information on what a class identifier is versus what a System.Type is. :)
Note: The language doesn't matter here, VB.NET or C# is fine, the code above is pseudocode.
I would like to compare dates (not times) for 2 datetime variables. I get one of the dates from database as follows and comapre it with yesterday.How can I do it?
[Code]...
Why does the first if statement evaluate to true? I know if I use "is" instead of "=" then it won't evaluate to true. If I replace String.Empty with "Foo" it doesn't evaluate to true. Both String.Empty and "Foo" have the same type of String, so why does one evaluate to true and the other doesn't?
//this evaluates to true
If Nothing = String.Empty Then
[CODE]...
I'm trying to set a text box equal to a value in dataGridView and I keep getting an error index out of range.The dataGridView is data bound to a stored procedure. When I move the text box setting to initiate after the form loads and a button is pressed it works fine; however, when it tries to automatically load after the fill command it errors out. The following code is what I have:
[Code]...
I want to test if an image in a picturebox is the same to another image in a picturebox?Also, i get my images from a listBox.I need to use i as a conditional in an if statement.
If (picBox2.Image = picBox1.Image) Then
' code ...
EndIf
[code].....
I would like to set stringa and stringb to be equal and then clear stringa like so:
Dim stringa as String = "abc"
Dim stringb as String
stringb = stringa
[Code]....
However this code sets up a link between the 2 variables, so when I clear stringa stringb is also cleared.
I am trying to write an IF statement that checks to see if a certain String variable is not equal to a certain value. What is the best way to do this?
Method #1
IF NOT(Nametxt.Equals("Fred")) Then
x = 3
[code].....
How do I declare/define a ResourceManager in the following code so it doesn't equal Nothing when it reaches rm.GetString("Magnitude") in the following code? My.Settings.. is returning a valid string.
Imports Gigasoft.ProEssentials.Enums
Imports System.Resources
Imports System.Configuration
[code]....
This makes no since to me I have a textbox that the user will put in information that I need to cut off so I wrote this code
txtMatID.Text = Trim(Mid(txtMatID.Text, 1, (InStr(txtMatID.Text,
"-") - 1)))
The user will imput a number value then a - then some words after that. I just want the number value. But when I try to debug the app it breaks on this line of code with this error. Argument 'Length' must be greater or equal to zero.
In my decryption statement I am getting
Argument 'Length' must be greater or equal to zero. is this statement wrong
DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4)) - 1)
I disabled an exception because it was bugging me i couldnt find an intermittent error. My program reads textmessages from a phone, however a problem sometimes arises, and I am slowly pinpointing the areas of the code that cause issues. I have found however that it is sometimes here:
'Get a string of certain length
Shared Function GetString(ByRef PDUCode As String, ByVal Length As Integer) As String
[Code]....
check to see if length is zero AND thereofre try again in a moment, (because it usually works second time for some reason). I can think how to get around the exception
How can i check a file's md5 if it's equal to one in a listbox?[code]...
View 3 RepliesI want to check If a variable is equal to some values or not, for example:
if a = 1 or a = 5 or a = 7 or a = 10
is it possible to do it like sql:
if a in (1,5,7,10)
what is the equal vb.net form event for vc++ ON_MESSAGE event
View 2 RepliesWhat I want is ListBox1 and ListBox2 above are not same Item
ListBox1.Items.Add("2")
ListBox1.Items.Add("4")
ListBox1.Items.Add("6")
ListBox1.Items.Add("8")
ListBox1.Items.Add("10")
[Code] .....
i will like to generate four numbers at random, that will total 100 and assign each to a textbox.
View 6 RepliesI'm facing a problem that Google couldn't solve yet!I'm trying to store URLs in an XML file. Problem is that these URLs contain Equal Signs (=) in them. And that generates an error.Here is my code: (**token is a variable that contains the URL)
Dim child As String = vbCrLf & "<Link URL='" & token & "'></Link>"
Dim fragment As XmlDocumentFragment = doc.CreateDocumentFragment
fragment.InnerXml = child
[code]....
Is there a statement to check if a does not equal b? or is it necessary to
vb
if a = b then
'blank
else
[code]....
I'm trying to load some data from a MySQL table and sort it so two equal rows doesn't come consecutive. I've been trying to do this on the server-side, but it looks like it's impossible. So I'm wondering if it's possible to load the data into a dataset and sort it there or something like that? I'm open for all solutions, both on the server-side and client-side.
[Code]...
I have the following
Dim input As String
If e.KeyCode = Keys.Enter Then
[code].....
I have been searching the internet trying to understand in its simplist form why this behavior happens.
Dim mysingle As Single = 456.11 Dim mybool As Boolean = mysingle = 456.11
In the lines above mybool becomes false. I found this behavior when putting the single into a double I found extra digits showing. The .net documentations states a single is an approimate value I gatehr a single is a 32bit floating point number? But why are extra digits appearing when I have explicitly said what the number is.. surely the memory should store that numbers either side of my number are 0 to fill up the memory location?
I have 10 checkboxes on my screen. I have a variable setup called "case" as a string. I want to know how I can say:
If checkbox1 is checked then case would be equal to "this".
If checkbox2 is checked then case would = "that"
Example of something I tried to cook up but didn't work because it tells me that I can't only use this in a "select case".
Dim Case as string
If checkbox1.checked = true
case = test1
end if
If checkbox2.checked = true
[Code] ......
A ListView (or ListBox) with following properties:
<ListView SelectionMode="Single">
<sys:String>James</sys:String>
<sys:String>Claude</sys:String>
[Code]....
will result in selecting two items simultaneously if I click on "James", even though I chose SelectionMode="Single". It's even the same behaviour when I use a helper class with a string-property to display in the ListView. It seems like the ListView is evaluating the Items and selecting those which are Equal() rather than ReferenceEqual(). Is there a way to change this behaviour so that the ListView treats every item individually?
Example:
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C: empcatalog.zip"
Dim sf As Object = Sh32.NameSpace(path)
-> does not work, sf = Nothing
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C: empcatalog.zip"
Dim sf As Object = Sh32.NameSpace(path.ToString)
Clearly path = path.ToString, but they behave differently when used as COM parameters.