|
When i use below code, it returns true and then i changed the condition to check m=1 then its returns false. I am little confused about booleans so please let me know the internal implementation about boolean.
Dim m As Boolean = 1
If m = -1 Then
MsgBox("true")
Else
MsgBox("false")
End If
I know that using "True" or "False" is best practise but for better understanding i need this
Thanks in advance
Regards
Azeem
|
|
|
|
|
A boolean can be either true or false. Best practice is not to use 1, -1,0 etc but use true and false as the actual values can be operating system dependant.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Once you set the Boolean = to 1 are you sure that it is staying at the value of 1 and not being altered to equal how VB internally stores a true or false value?
Why do you want to create a Boolean then assign it a number and compare it to a number?
|
|
|
|
|
Trying to locate a link that shows you why this happens, but what you are seeing is type conversion related. VB.NET stores false as a 0 and any other value as true, but that defaults to being stored as = -1.
So, when you assign the Boolean = 1 it gets converted internally to -1 because it is not a false value (0).
Try doing a few debug.prints and setting the Boolean to a few values and see what happens.
It looks to me like you do not have option strict turned on. If not, you should because it forces your code to be far more explicit and not allow type coercion (dynamic type conversion) like this.
|
|
|
|
|
0 = nothing = false, the rest is always true
A more proper boolean;
enum MyBool = {
true,
false,
EFileNotFound}
I are troll
|
|
|
|
|
Respected Experts,
I have doubt to get one solution.My task is ,is it possible to take some mobile while we put a data cable to system the folders are be visible in the computer.Shall is any way to create a component in windows form using c#.net ,that by clicking one button the folders may be the sms or images should be copied or drag and drop to that windows form from the mobile.Please suggest me related to this task.
Thanks and Regards
Ch.Gayatri
|
|
|
|
|
Ch.Gayatri Subudhi wrote: ,is it possible to take some mobile while we put a data cable to system the folders are be visible in the computer.Shall is any way to create a component in windows form using c#.net ,that by clicking one button the folders may be the sms or images should be copied or drag and drop to that windows form from the mobile.
Uhhh... I understand English is not your first language, but this doesn't make any sense at all. I have no idea what you're trying to describe.
|
|
|
|
|
I need to create a windows application that while i click a button in the windows form ,the mobile which is connect through datacable to system,the folder which one present in the mobiles like messeges and picture should be copied to the windows form.
Thanks and Regards
Ch.Gayatri
|
|
|
|
|
|
dear frenz,
i need to store the name of the parent node of the node selected in a treeview
i have used the following code:
parent = TreeView1.SelectedNode.Parent.Parent.Name.ToString()
but this gives the o/p as "TreeNode: 1203"
whereas i only want the o/p as "1203"
where 1203 is the parent node of the selected node.
treeview node level 0= 1203
treeview node level 2= selected node.
plz help asap.
|
|
|
|
|
You are getting but this gives the o/p as "TreeNode: 1203" because that is the name of the node.
try using parent = Treeview1.SelectedNode.Parent.Text;
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Okay, here's a weird, nit-picky question:
I've added a new toy to the tools collection in my text editor. It changes contractions back to their "formal" form: "It's" to "It is" and so forth. So...
Is there a word for this process? "Expand" a contraction, maybe? "Replace" a Contraction? I'm trying to figure out the proper text for the menu item.
|
|
|
|
|
Well the antonym for contraction would be expansion - but I like the idea of altering con-traction and changing it to dis-traction - there's a certain logic there
I just love Koalas - they go great with Bacon.
|
|
|
|
|
Lee Humphries wrote: I just love Koalas - they go great with Bacon.
And, they're a lot easier to kill than grizzlies.
|
|
|
|
|
AntiTraction
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
as always, ask Google[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Looks like "Expansion" is the word. I was leaning in that direction, and it appears others agree.
Thanks and Happy Sunday -
AB
|
|
|
|
|
Hi all,
I'm starting a new project here and I mean from scratch! I'm using Visual Studio. I was thinking of setting up several different projects within the solution because they'd then all be exes and I could update by overwriting other exes while the main program is still running. But I'm not sure if that's the right way of going about things.
What's the best way for me to set up my project so that I can update my users in the future while the program is still running? Is it DLLs I want to use? Or what? Thanks!
Denise "Hypermommy" Duggan
|
|
|
|
|
Hi,
DLL files won't really help, since they get loaded and locked by the running EXE, so you cannot just hot-swap them.
IMO the simplest scheme is having two EXE files:
- APP.EXE + its DLL files = the actual application;
- LAUNCH.EXE = a very simple EXE that launches APP.EXE, or updates the APP.EXE file. You must keep this one simple, since it will not be able to replace itself. And it should not use any of the app's DLL files.
You might consider making it reciprocal, i.e. also teach APP.EXE how to replace LAUNCH.EXE; however this creates the risk that, when something goes wrong, both EXE files become useless.
|
|
|
|
|
That sounds like a very good idea. I was hoping that folks could download updates and apply them without having to exit the program. I guess if there's some way that App could start up the Launch app and then close itself and then the Launch app would relaunch the app, that might work. Could get me into a loop though.... I should definitely think about this one.
Any ideas or thoughts?
And thanks for your answer!!!!
Denise "Hypermommy" Duggan
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
i did something quite some time ago.
i used just one .EXE... if i found one update on the web server i download it to a temp file then i create a batchfile. that renames the files... i run the batchfile and close my application... i use a timeout command on the batch file that way i'm sure the time the user presses a key on the batch file window or the timeout expires my main application windows is already closed....
|
|
|
|
|
Hi
I have two tables
1)
Categories
CategoryID --- PK
Category Name
2)
Subcategories
CategoryId----FK
SubCategory
I would like to display the category name from Categories table in combobox.
Based on the selection from the combobox corresponding subcategory from the Subcategories table( here Category id can be duplicate)in the listbox.
Is the table constructed good...?
Would be nice if anyone could help me in this.
Thanks
Sathi
|
|
|
|
|
AKSSMV wrote: Is the table constructed good...?
Yes
AKSSMV wrote: Would be nice if anyone could help me in this.
Help you with what?
|
|
|
|