|
Sure, those things exist in the database, but are they objects in your code?? Or do those references return "Nothing", or null in the C, C++, C# worlds. When the code breaks and returns to the debugger, you can check to see if those objects actually return anything by hovering the mouse of them or looking in the Local Watch window.
|
|
|
|
|
Hi guys,I have a project to come up with a calculator to perform basic addition,subtraction,multiplication and division. I came up with the code below but it only adds correctly the first time...multiple addition always gives me a wrong answer and so does any attempted subtraction,multiplication and division....point out the errors please
CALCULATOR CODE:
Public Class Form1
Dim total1 As Single
Dim total2 As Single
Dim total3 As Single
Dim result As Single
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn5.Text)
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn1.Text)
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn2.Text)
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn3.Text)
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn4.Text)
End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn6.Text)
End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn7.Text)
End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn8.Text)
End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn9.Text)
End Sub
Private Sub btnzero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btnzero.Text)
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
total1 = Val(txtdisplay.Text)
total1 = total1 + Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub btneql_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneql.Click
txtdisplay.Text = result
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
txtdisplay.Clear()
total1 = 0
End Sub
Private Sub btntimes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntimes.Click
total1 = Val(txtdisplay.Text)
total1 = total1 * Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub Buttbtndivideon15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttbtndivideon15.Click
total1 = Val(txtdisplay.Text)
total1 = total1 / Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub btnless_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnless.Click
total1 = Val(txtdisplay.Text)
total1 = total1 - Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
End Class
|
|
|
|
|
keymoney wrote: point out the errors please
Other than the entire application?? Serisouly, IMHO, the entire thing needs to be scrapped and rewritten.
I'll give you a hint. You only need to keep track of two numbers. The first is an accumulator, the second is the current value in the display. All the math operations occur using just those two numbers.
|
|
|
|
|
keymoney wrote: ...it only adds correctly the first time...
Are you sure?
Trying to follow your logic, enter 15, press add, result now equals 30, display cleared. Enter 6, press equals, display shows 30, instead of 21, the actual sum. (Or at least I think it does - just reading it makes my head hurt...)
Your logic is, for want of a better word, insane.
total1 = Val(txtdisplay.Text)
total1 = total1 + Val(txtdisplay.Text)
total2 = total1
result = total2
What, exactly, do you think that code does? You need to step through in debug mode, looking at the values of the variables you're setting. Then, as Dave K. above suggests, throw it away and start again...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hi,
I am doing a project related to School management. In that i was assigned by a module called Accounts Module. In this module i have to create Groups(like Assets,Liabilities,etc.,) and Accounts in the Treeview format.
I have one Textbox and two Comboboxes, in one combobox i have to select Group/Account, In the other combobox, i have to select 'under' which group the textbox value should be saved. We can add 'n' number of childs, sub childs Under the Groups, But when we select Value in the combobox as Account, we cannot add any values under the Account.
For better understanding, i will give a sample Treeview structure..
Assets (Group)
|-Current Assets (Group)
|-sample1 (Account)
|-sample2 (Account)
|-fixed assets (Group)
|-samp1 (Account)
liabilities (Group)
|-current liabilities (Group)
|-samp1 (Group)
|-samp2 (Acccount)
i think this is the best example..
Can anyone please help me in completing this Task..
Thanks in Advance,
Victoria
VB.Net
|
|
|
|
|
Is it possible to align the Richtextbox text as fullfill the blank spaces.
I mean, if the richtextbox is entered half line, and remianing blank spaces of half line has to remove and the text has to be upto the end of that line like, word alignment
I set the followings
RichTextbox1.Maxlength=300
RichTextBox1.SelectionStart = 0
RichTextBox1.SelectionLength = 0
Thanks
|
|
|
|
|
Not supported. You'll have to find a 3rd party control that does support what you want, or (much more difficult) write your own version of the RTB.
|
|
|
|
|
Hello All,
Actually I am working with mobile application for sending sms for list. But When i am try to send message by using thread the mobile will be hang and Message not sends.
CScreateprocess is a function for sending sms. It takes time for sending sms because it checks credential.
If you can think then I Can.
|
|
|
|
|
What do the docs for the SMS API you're using say ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
CeCreatePRocess Is used for Sending SMS.
If you can think then I Can.
|
|
|
|
|
No, CeCreateProcess is used on Windows CE to create a new process, like Process.Start. You may well be able to start a process that sends an SMS, but CeCreateProcess is, in itself, nothing to do with SMS, in any way, shape or form. RTFM.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
eg_Anubhava wrote: Actually I am working with mobile application for sending sms for list. But When i am try to send message by using thread the mobile will be hang and Message not sends. "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/IV
Support CRY- Child Relief and You
|
|
|
|
|
NO IT'S WRONG. MY FUNCTION AND LOOP IS CORRECT.
THE PROBLEM IS THAT WHEN I M SENDING MESSAGE CeCreatePROCESS TAKES REQUEST FROM SERVER AND THIS TIME ANOTHER RESUEST IS COMES FOR SENDING MESSAGE. AND THEN MOBILE WILL BE HANG. SO SOME MESSAGE NOT SEND.
If you can think then I Can.
|
|
|
|
|
|
what it means.
If you can think then I Can.
|
|
|
|
|
Actually i am having a list of controls in multiple Controls selections like Picturebox,Textbox ,Label,LinkLabel etc .
Now i got Picturebox in the Multiple selection of control .
In cCustomProperties Class i am having FORECOLOR ,BACKCOLOR ,FONT ,SIZE , LOCATION
Common Properties class all the controls to show for multiple controls if selected in the propertygrid.
Case :: 1
If i get the PICTUREBOX in the List Of Multiple Controls i want to hide the FONT,FORECOLOR,BACKCOLOR Properties and to show only LOCATION,SIZE PROPERTIES .
Case :: 2
For LINKLABEL i am fixing the size of the Linklabel to 7,7 and label text as * .So if i get the linkLabel in the list of Multiple controls i want to hide the SIZE ,FORECOLOR,BACKCOLOR PROPERTIES
Presently i am taking different class for all these conditions and doing Permutations & Combinations . Which is Risky THING TO DO THE THINGS . I want to Stop doing all these non-Sense things .
I want to implement the way in visual studio if Multiple Controls are selected . In the PropertyGrid i get only the properties which are common to all the controls .
Ex :: Consider the label and Picturebox in Multiple Selection. THE FONT PROPETY is hiding . IN THIS WAY DYNAMICALLY .
Regards
|
|
|
|
|
I've never done anything like that before, but I can think of one method that might work.
Enumerate the properties of each control. Put the property names in a collection and count the name of times each property is found for each control. Now go through the collection of property names and look at their count values. If the count equals the number of controls selected, you've found your common property names.
|
|
|
|
|
I compress data in a stored procedure delivering it to the applicatiom as a dataset. That dataset is then bound to the aspx page in a datalist and a textbox.
If the data is entered in the textbox, then I need to extract the data from the datalist on that row. I know there is a way to get the textbox data with a "FindControl", no problem, I just don't know how to get the rest of the data for that row.
Can you assist with 1 or 2 lines of VB code, as to how to return the actual data from the row.
Thanks
Chuck
modified on Friday, June 5, 2009 12:42 PM
|
|
|
|
|
I can't, but somebody in the ASP.Net forum is likely to be able to.
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.”
|
|
|
|
|
Thanks for trying Henry, but this is not an ASP.Net problem. This a VB.NET WebForm code problem. I asked an application code question in asp forum yesterday and got shouted out. I wont do that twice.
|
|
|
|
|
Sorry!
I wouldn't have done that deliberately, I read as far as aspx, and thought 'not another one'.
Hope you get a response from someone with more than two brain cells.
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.”
|
|
|
|
|
Hello
does anyone knows how to communicate through a VPN in VB.Net 2005. I have implemented the communication with the WI-FI but my company wants the ability to call when they are not near a hot spot. I used RAPI for the WI-FI but I cannot figure out what to use for the telephony part.
Any help or guidance would be appreciated.
clanguage
Software Engineer
|
|
|
|
|
I don't think I understand your question.
The way my VPN works on my laptop is that it is a small piece of software that I run when I am not inside my office network, like at a hotel. The hotel provides me with a connection to the Internet and the VPN software provides the "secure tunnel" for me to connect to my corporate network.
Once the VPN is started, everything on my laptop works, nothing special to access corporate network resources. This would mean that if I had a Symbol Scanner connected to my laptop and I was reading barcodes against a database that is back at the office, the scanner would work just fine.
The VPN does all the work for you. Your program that controls the scanner wouldn't even know that it was connecting through a VPN.
What is your problem ? You may have an issue with your application not being able to resolve server names; if so, it is most likely a problem with how your VPN is configured.
Here is a simple test. While connected to your corporate network you should be able to "ping myserver". Now outside the corporate network, start your VPN and try the "ping myserver" test again. If it doesn't work, then you need to resolve that first. Your application won't work if it can't resolve the "myserver" while the VPN is running.
|
|
|
|
|
Sorry I was not more explicit. I am scanning barcodes and other datum with the Symbol scanner and I must transfer it to a database situated sometimes thousand of miles away. I am using VB.Net 2005 to write the applicaiton.
First I need to unsure that I can connect and once I have a connection i need to update the database. Finally i must close the connection. I have no problem acccessing the VPN with the scanner manually but I must do it programmaatically.
clanguage
Software Engineer
|
|
|
|
|
The VPN connection should not be done in your app at all. This would tie your application to that specific VPN provider and make it pretty much impossible to change the VPN your company uses without changing your app.
Start the VPN connection from outside and seperately from your app, then start your app and it'll connect to the database without even knowing the VPN is there.
|
|
|
|
|