你明白我想要得到什么吗? [英] Do you understand what I'm trying to get ?
问题描述
我会列出问题
- Combobox OS1 - PSPD1无法在编码中定义它的项目:A +,A-等。
- 它是item无法转换为double。
- 我无法将组合框项目调用到计算中。
我完全是一个初学者用C#编码。我试图找到解决方案,太糟糕了,它没有按照我的程序的方式工作。
谢谢你的帮助。言语无法形容我多么感激。我很感激。
我的尝试:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Click,OS1,CSA1,ICS1,MC1,PM1,PF1,PSPD1 >
如果sender.Text = A +那么
文字= 4.0
结束如果
如果sender.Text = A那么
文字= 4.0
结束如果
如果sender.Text = A-那么
文字= 4.0
结束如果
如果sender.Text = B +那么
文字= 4.0
结束如果
如果sender.Text = B那么
文字= 4.0
结束如果
如果sender.Text = B-那么
文字= 4.0
结束如果
如果sender.Text = C +那么
文字= 4.0
En d如果
如果sender.Text = C-则
Text = 4.0
结束如果
如果是发件人。文字= D然后
文字= 4.0
结束如果
如果sender.Text = D-那么
Text = 4.0
结束如果
total =((OS1.Text + CSA1.Text + ICS1.Text + MC1.Text + PM1.Text + PF1.Text + PSPD1。文本)* 19.0)/ 7
结束子
结束类
I'll list out the problem
- Combobox OS1 - PSPD1 can't define it's item in coding ex: A+,A- and etc.
- It's item can't convert into double.
- I'm unable to call the combobox items into calculation.
I'm totally a beginner in C# coding. I've tried to find the solution, too bad, it didn't work out specifically the way my program works.
Thank you for the help. Words can't describe how thankful I am. I'm just grateful.
What I have tried:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, OS1 , CSA1 , ICS1 , MC1 , PM1 ,PF1 ,PSPD1
If sender.Text = A+ Then
Text = 4.0
End If
If sender.Text = A Then
Text = 4.0
End If
If sender.Text = A- Then
Text = 4.0
End If
If sender.Text = B+ Then
Text = 4.0
End If
If sender.Text = B Then
Text = 4.0
End If
If sender.Text = B- Then
Text = 4.0
End If
If sender.Text = C+ Then
Text = 4.0
End If
If sender.Text = C- Then
Text = 4.0
End If
If sender.Text = D Then
Text = 4.0
End If
If sender.Text = D- Then
Text = 4.0
End If
total = ((OS1.Text + CSA1.Text + ICS1.Text + MC1.Text + PM1.Text + PF1.Text + PSPD1.Text) * 19.0) / 7
End Sub
End Class
推荐答案
你需要使用引号字符围绕文本字段,例如:
You need to use quote characters around text fields, e.g.:
If sender.Text = "A+" Then
Text = "4.0"
End If
也是计算tota的语句l将无法正常工作,因为您尝试在数值计算中使用文本字符串。
理解基础知识是编程中最重要的事情之一。回到你的课程笔记,或者获得一本关于Visual Basic的好书来帮助你。
Also the statement to calculate the total will not work as you are trying to use a text string in a numeric calculation.
Understanding the basics is one of the most important things to learn in programming. Go back to your course notes, or get a good book on Visual Basic to help you.
这篇关于你明白我想要得到什么吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!