|
I have to write this code which will calculate the cost of a pizza with toppings. I have created a drop down menu for the pizza size and it is working properly and will updated as a different size is selected.
The checkboxes are the problem. The checkboxes will update if I select them from right to left, but if I try to select them at random(ie...backwards), the values do not appear.
Anyone have any ideas as to what I am doing wrong?
Code is listed below:
Dim total1 As Decimal
Dim total2 As Decimal
Dim total3 As Decimal
Dim total4 As Decimal
Dim total5 As Decimal
Dim sizetotal As Decimal
Private Sub sizebox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sizebox.SelectedIndexChanged
sizebox.Items.IndexOf("Small")
sizebox.Items.IndexOf("Medium")
sizebox.Items.IndexOf("Large")
If sizebox.Text = "Small" Then
sizetotal = "7.00"
ElseIf sizebox.Text = "Medium" Then
sizetotal = "9.00"
ElseIf sizebox.Text = "Large" Then
sizetotal = "11.00"
End If
totallbl.Text = "Total is: " & sizetotal
If pepckbx.CheckState = CheckState.Checked Then
total1 = 0.5
Else : total1 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1
If mushckbx.CheckState = CheckState.Checked Then
total2 = 0.5
Else : total2 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2
If pineckbx.CheckState = CheckState.Checked Then
total3 = 0.5
Else : total3 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3
If onckbx.CheckState = CheckState.Checked Then
total4 = 0.5
Else : total4 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3 + total4
If pprckbx.Checked = True Then
total5 = 0.5
Else : total5 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3 + total4 + total5
End Sub
Private Sub pepckbx_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pepckbx.CheckedChanged
If pepckbx.CheckState = CheckState.Checked Then
total1 = 0.5
Else : total1 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1
End Sub
Private Sub mushckbx_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mushckbx.CheckedChanged
If mushckbx.CheckState = CheckState.Checked Then
total2 = 0.5
Else : total2 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2
End Sub
Private Sub pineckbx_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pineckbx.CheckedChanged
If pineckbx.CheckState = CheckState.Checked Then
total3 = 0.5
Else : total3 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3
End Sub
Private Sub onckbx_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles onckbx.CheckedChanged
If onckbx.CheckState = CheckState.Checked Then
total4 = 0.5
Else : total4 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3 + total4
End Sub
Private Sub pprckbx_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pprckbx.CheckedChanged
If pprckbx.CheckState = CheckState.Checked Then
total5 = 0.5
Else : total5 = 0
End If
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3 + total4 + total5
End Sub
|
|
|
|
|
Looks to me like you could have one internal total, one check changed event handler, and just add or subtract .5 as the checks get set or unset.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
bob1070 wrote: The checkboxes will update if I select them from right to left, but if I try to select them at random(ie...backwards), the values do not appear.
The problem is, the checkboxes only total from the left to the right. So If you check the PPR check box, you total all the check boxes. But then, if you check the PEP check box (ie...backwards), you are recalculating the total, but only totaling the sizetotal and total1.
You need to have
totallbl.Text = "Total is: " & sizetotal + total1 + total2 + total3 + total4 + total5
in each of your ckbx_CheckedChanged subs.
Roy.
|
|
|
|
|
Hi,
I want to create a scanning system that will later be implemented into an anti spyware scanner written using Visual Studio 2003.
workspace below:
http://www.gotdotnet.com/workspaces/workspace.aspx?id=86fc2a2c-f857-446f-9f0c-37d27b64ffde
I want it to work like this: The program will scan through every file on the system and return its MD5 key. It will then compare the MD5 key to a list in a large file included with the program. If an MD5 key matchs with one in the definitionss file, then it will be removed or disabled or repaired depending upon what type of spyware it is.
So far i have the code for returning an MD5 hash key, creating a definitions file and reading it, and removing spyware. If anyone can contribute anything that might be of use, please let me know as have been working on this project for a year and still havn't completed it..
Could anyone please help me out ?
Thanks
|
|
|
|
|
Not to be a kill-joy by any means (I know what it is like to work for years on something and still not be done) you seem to be taking a very minimalist approach to spy-ware removal if all you are doing is dealing with the files. There are at very least possible registry keys that needs to be dealt with.
Aside form that, what help to you need? Taking the approach you are taking (unless I have missed something) it sounds like you are almost there.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
No, you are right we are removing more than just files; however that is a huge part of the process.
The program Targets all of the following: Bho's, Active X, LSP's, Startup, Processes, Toolbars, Trogans, Tracking Cookies, and other files.
I have written a removal class to do all of this, so all i am working on right now is the scanning.
However I am only 15, and i have limited knowlage of these procedures as i taught myself to program in vb.net
|
|
|
|
|
Hello
I am a new member of this group. I looked at previous messages and files uploaded but cant find exactly how towrite a code in excel visual basic editor that can dictate what ı said to a text box or other controls..
ı managed to write the code that can run commands but it works only with specific words that ı write to a Gramer file
can u show me an example that is able to translate every word in english to text file....
how shoud ı change the code
directsr1.grammarfromstring
by the way I am using Microsoft Speech SDK
thank you very much
Mustafa
|
|
|
|
|
I am writing a DB program which have to be deployed on a network> I am using VB. I heard from someone that i can use a INI files, which will make it possible to move the DB without having to rewrite the program. Can anyone tell me how to do that.
THANX.
|
|
|
|
|
Hi
if you want to use ini-files, try seek for GetPrivateProfileString and WritePrivateProfileString in help-index.
Kind Regards
Thomas Vanting
|
|
|
|
|
Vanting,
I tried but i dont understand how it works. Because i put the declaration in my form_load and get an error, then i declare it in the general section same problem. What next.
Please advice details.
|
|
|
|
|
Hi,
I am new in VB.net. I have a problem while debugging a windows application, which will read a bmp image and save it after processing. I used the following code
//Opening an image
private sub button1_click (Byval sender as object,Byval e as system.eventergs)
dim odlg as new openfiledialog()
odlg.filter = "Bitmap(*.bmp)|*.bmp"
if (odlg.showdialog=dialogresult.ok) then
picturebox1.image = image.fromfile(odlg.filename)
picturebox1.invalidate()
end if
end sub
//Saving an Image
private sub button2_click (Byval sender as object,Byval e as system.eventergs)
dim sdlg as new savefiledialog()
sdlg.filter = "Bitmap(*.bmp)|*.bmp"
if (odlg.showdialog=dialogresult.ok) then
picturebox1.image.save(sdlg.filename)
picturebox1.invalidate()
end if
end sub
While I open an image "b.bmp" and after processing it want to overwrite the same an error occurs, saying:
"An unhandled exception of type
System.Runtime.InteropServices.ExternalException occurred in System.Drawing.dll
Additional information: A generic error occurred in GDI+."
What should I do now, how can i overcome this problem?
Please help me. Thanks in advance.
Anindya Chatterjee
|
|
|
|
|
This code works fine for me. I was able to open a bitmap using button 1 and
when i click on Button 2 i was able to save the image with the new filename.
The only change i did was in Button 2 code, you have the 3rd line
****if (odlg.showdialog=dialogresult.ok) then****
i made it to ***if (sdlg.showdialog=dialogresult.ok) then***. Jope it was a typo error.
|
|
|
|
|
Hi
I am trying to print to a dot matrix printer from VB.Net windows application. I haven't found one example on how can I do this. I know that with VB 6.0 you can set the X and Y co-ordinates and then send a string to printer. I need some sample code. I do know that I should be using the PrintDocument object in combination with the Graphics object. An example would help a lot. I tried but I am not sure how to specify the X,Y co-ordination for each type set.
|
|
|
|
|
|
I know that artical because i wrote that
i know raw data printing but i heard i can achive this, using printDocument object
|
|
|
|
|
How can I change the column names in DataGrid to be different from the names of table columns?
|
|
|
|
|
The property you're looking for is HeaderText
You can also point your help to:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VSADD.v10.en/dv_vstechart/html/vbtchFormattingWindowsFormsDataGridVisualBasicPrimer.htm
to have a complete overview of columns formatting.
|
|
|
|
|
I've developed small applications for my friends to help them in some of their tasks. However, when I gave them the exe file, there seems to be an error that pops up. One said that there was a problem in executing the code, and another doesn't have the permission to execute a web request. Most of the code samples I've found has to do with ASP. I hope someone can help or point out to me with how to code permissions or exceptions into VB .Net code. Thanks in advance.
|
|
|
|
|
How about posting the exception data here so we can see it?
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Sorry for the late update. This is the message box that gets displayed:
"The application attempted to perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application the required..."
I want to allow normal users to use this program. Not sure how to go about this. I want it to be done via the code and not through giving permissions from manage users.
|
|
|
|
|
could anyone can guide me if i want to display a bar chart by using the VB ?
|
|
|
|
|
Normally, I use third party controls which are available from Infragistics www.infragistics.com. You could use ultrawinchart for windows and ultrawebcharts for the web development.
|
|
|
|
|
hi,
1st of all, i like to say thx to you. but i have search on that web-site, i can't find the ultrawinchart ?which software i have to download? howabout i tell you what i want ? 8tually i'm writing a program (using the VB6) which is a SMS voting system. the system will collect the sms vote and then display out a bar chart. So, could i draw out a bar chart using by the VB6? is it necessary need others drawing software?
|
|
|
|
|
The following code works in VS 2005 / VB .Net, however it says myengine declaration ..... is obsolete in VS 2005. Could any one let me know the better approach to evaluate the expression in VS 2005.
Thanks
Prem
Dim sExpression As String = "1 + 1 "
Dim myengine As Microsoft.JScript.Vsa.VsaEngine =
Microsoft.JScript.Vsa.VsaEngine.CreateEngine()
Dim oResult As Object
oResult = Microsoft.JScript.Eval.JScriptEvaluate(sExpression, myengine)
MsgBox(oResult)
|
|
|
|
|
Hi,
I am a newbie to VB.NET and I'd like to create a project containing a web browser window. I used to play a little with vb 6 in the past, but it's quite long time. I remember there was some object like webbrowser window... is this possible also in vb.net? I couln't find it
|
|
|
|