Cov txheej txheem:

BMI Tshuab xam zauv: 6 Cov kauj ruam
BMI Tshuab xam zauv: 6 Cov kauj ruam

Video: BMI Tshuab xam zauv: 6 Cov kauj ruam

Video: BMI Tshuab xam zauv: 6 Cov kauj ruam
Video: Tshais nkauj neeb #TobTobStudio 2024, Kaum ib hlis
Anonim
BMI Tshuab xam zauv
BMI Tshuab xam zauv

Kuv lub npe yog Umair Bin Asim. Kuv yog tub ntxhais kawm ntawm Kev Xav Hauv Ntiaj Teb, ua kuv qib O. Txoj haujlwm no yog ib feem ntawm kev tshaj tawm txog kev paub uas kuv thiab kuv cov phooj ywg kawm tam sim no tau ua. Peb lees paub kev rog yog qhov teeb meem nce thoob plaws ntiaj teb thiab txhawb cov tib neeg los tawm tsam kev rog dhau ua ntej nws ua rau muaj kev puas tsuaj loj hauv zej zog. Txoj haujlwm no yog ib qho ntawm peb cov phiaj xwm kev paub ntau yam.

Lub laij lej BMI, yog kom tib neeg yooj yim dua hauv kev suav lawv lub cev qhov hnyav thiab txiav txim siab seb puas rog lossis tsis yog. Lub laij lej peb tau ua yog teeb tsa hauv cov qauv ntawm koom haum saib xyuas kev noj qab haus huv hauv Asmeskas. Lub hom phiaj ntawm kev tshaj tawm qhov no yog tso cai rau tib neeg tsis tsuas yog ua lub laij lej tab sis kuj tseem tso cai rau tib neeg hloov kho lawv lub laij lej mus rau yam twg lawv tus qauv hauv tebchaws yog.

Kauj Ruam 1: Tsim Qhov Project Visual Studio Tshiab

Tsim kom muaj qhov Visual Studio Project Tshiab
Tsim kom muaj qhov Visual Studio Project Tshiab
Tsim kom muaj qhov Visual Studio Project Tshiab
Tsim kom muaj qhov Visual Studio Project Tshiab
  1. qhib qhov muag pom studio
  2. nyem rau ntawm qhov project tshiab
  3. xaiv poj ntsuam daim ntawv thov
  4. rename qhov project rau "BMI lub laij lej"
  5. txuag txoj haujlwm thiab nco qab qhov chaw (Kuv tau khaws nws hauv cais tsav)

Kauj Ruam 2: Ob Tshooj

Ob Tshooj
Ob Tshooj

muaj ob ntu hauv Visual studio windows daim ntawv thov

1) Form1.vb [Tsim]

nyob ntawm no koj tsim GUI

2) Form1.vb

hauv no koj sau koj cov programming

koj tuaj yeem xaiv cov tab los ntawm kev xaiv rau lawv

Kauj Ruam 3: Tsim Tus Txheej Txheem (cov ntawv cim thiab cov ntawv nyeem)

Tsim lub Interface (daim ntawv lo thiab Textboxes)
Tsim lub Interface (daim ntawv lo thiab Textboxes)
Tsim lub Interface (daim ntawv lo thiab Textboxes)
Tsim lub Interface (daim ntawv lo thiab Textboxes)

hauv cov kauj ruam no koj yuav tsum tsim cov duab siv interface.

  1. xaiv cov ntawv cim los ntawm lub cuab yeej muaj (yog tias koj tsis tuaj yeem pom lub cuab yeej lub thawv nias Ctrl+Alt+x)
  2. luag daim ntawv lo rau ntawm daim ntawv thiab npaj lawv ntawm sab xis. peb xav tau peb daim ntawv lo
  3. npaj cov ntawv raws sab laug
  4. nyem rau ntawm daim ntawv lo thiab hauv cov khoom hloov Autosize rau FALSE, qhov no yuav tso cai rau koj hloov daim ntawv lo.
  5. nyem rau ntawm daim ntawv lo thiab hauv cov khoom hloov cov ntawv mus rau "qhov siab", "qhov hnyav", "koj li BMI", feem.

  6. koj kuj tseem tuaj yeem hloov lwm qhov chaw hauv cov khoom xws li xim thiab cov nyhuv 3D.
  7. luag peb lub thawv ntawv los ntawm lub cuab yeej thiab ua raws lawv ntawm sab laug mus rau daim ntawv lo
  8. nyem rau ntawm lub thawv ntawv thiab hauv cov khoom hloov lub npe teeb tsa rau "txtheight", "txtweight", "txtresults"
  9. koj kuj tseem tuaj yeem hloov lwm qhov chaw hauv cov khoom xws li xim thiab cov nyhuv 3D.
  10. tsim lub thawv ntawv kawg thiab ua raws nws hauv qab, sau lub npov ntawv no "txtcomment", qhov no yuav muab qhov tshwm sim los ntawm cov neeg BMI raws li kev nkag siab los ntawm tus lej ib leeg yuav nyuaj.
  11. hloov lub npe yog qhov tseem ceeb raws li peb yuav tau hu cov kab ntawv no hauv peb qhov haujlwm, yog tias koj xav tso lwm lub npe koj yuav tsum hloov lub npe ntawm lub npe xa mus rau hauv qhov haujlwm ib yam. (cov npe yog raws li kuv qhov program)

Kauj Ruam 4: Tsim Tus Txheej Txheem (cov nyees khawm)

Tsim lub Interface (nyees khawm)
Tsim lub Interface (nyees khawm)

tso cov nyees khawm los ntawm kev rub lawv los ntawm lub thawv ntawv thiab ua kom lawv raws li qhia hauv daim duab

thaum lub khawm raug xaiv hloov lub npe ntawm lub pob hauv cov khoom, thiab koj tuaj yeem hloov cov ntawv teeb tsa ib yam.

  • tsim lub npe khawm "btncalc", nrog cov ntawv "xam BMI"
  • tsim lub npe khawm "btnclear", nrog cov ntawv "meej"
  • tsim lub npe khawm "btnexit", nrog cov ntawv "tawm"
  • tsim lub npe khawm "btnaboutout", nrog cov ntawv "kawm paub txog peb"
  • tsim lub npe khawm "btnhlp", nrog cov ntawv "xav tau kev pab?" (Kuv tsis tau siv qhov no thiab nws tau raug tso tseg dawb yog tias koj xav ntxiv khawm pab)

kho cov nyees khawm hauv GUI daim ntawv raws li koj pom zoo

hloov lub npe yog qhov tseem ceeb raws li peb yuav tau hu cov nyees khawm no hauv peb qhov haujlwm, yog tias koj xav tso lwm lub npe koj yuav tsum hloov lub npe ntawm lub npe xa mus rau hauv qhov haujlwm ib yam. (cov npe yog raws li kuv qhov program)

Kauj Ruam 5: Ua Haujlwm Rau Koj Lub Tshuab Ntsuas

Programming Koj Lub Luag Haujlwm
Programming Koj Lub Luag Haujlwm

Public Class Form 1

Private Sub btncalc_Click (sender As System. Object, e As System. EventArgs) Handles btncalc. Click

Dim qhov siab li Ob npaug = 0 'tsim qhov sib txawv hu ua qhov siab Dim hnyav Raws li Ob npaug = 0' tsim qhov sib txawv hu ua qhov hnyav Dim BMI Raws li Ob = 0 'tsim qhov sib txawv hu ua BMI

txtresults. Text = ""

qhov siab = Double. Parse (txtheight. Text) 'nyeem cov lej los ntawm kab ntawv txtheight thiab txuag nws mus rau qhov sib txawv qhov sib txawv = Double. Parse (txtweight. Text)' nyeem cov lej los ntawm kab ntawv txtweight thiab khaws nws mus rau qhov sib txawv sib txawv qhov siab = qhov siab * 0.0254 'hloov qhov siab mus rau qhov hnyav = hnyav * 0.4535924' hloov qhov hnyav mus rau qhov siab qhov siab = qhov siab * qhov siab 'plaub fab sib luag thiab txuag nws mus rau qhov sib txawv qhov siab

Yog ((qhov siab <= 0) Los yog (qhov hnyav <= 0)) Tom qab ntawv 'siv tau qhov tseeb kom ntseeg tau tias cov ntaub ntawv tsis raug cai tsis nkag mus rau kev ntxuav () MsgBox ("thov ntxig qhov muaj txiaj ntsig zoo")

BMI = qhov hnyav / qhov siab 'xam ntawm BMI

BMI = Hom ntawv (BMI, "0.00") 'sau BMI rau ob qhov zauv zauv txtresults. Text = BMI' sau BMI hauv kab ntawv txtresults txtcomment. Text = "" 'empties textbox saib kom tso cai cov ntaub ntawv

'suav qhov xwm txheej raws li BMI

Yog BMI <18.5 Tom qab ntawv 'qhov xwm txheej yuav txawv hauv koj lub tebchaws

txtcomment. Text = "koj hnyav dua"

ElseIf ((BMI> = 18.5) Thiab (BMI 24.9) Thiab (BMI 29.9 Tom qab ntawd txtcomment. Text = "koj rog, thov ua tib zoo" End Yog

Xaus Sub

Private Sub btnexit_Click (sender As System. Object, e As System. EventArgs) Handles btnexit. Click

Kaw () 'muaj nuj nqi rau tawm End SubPrivate Sub btnclear_Click (sender As System. Object, e As System. EventArgs) Handles btnclear. Click cleanup () 'call sub routine cleanup End Sub Sub cleanup ()' clears each textbox txtcomment. Text = "" txtheight. Clear () txtweight. Clear () txtresults. Text = "" txtheight. Focus () End Sub

Private Sub btnabout_Click (sender As System. Object, e As System. EventArgs) Handles btnabout. Click

'qhov no yog cov lus qhia hauv ib qho kev sib cais

'koj tuaj yeem ntxiv ib yam twg uas koj xav tau tom qab "=" kos npe hauv qab no tab sis nws yuav tsum yog nruab nrab ntawm ob tus lej ("")

Dim lus Raws li txoj hlua = "Qhov Software no tau tsim los ntawm Umair Bin Asim Rau Qhov Sake Ntawm Kev Paub Txog Kev Noj Qab Haus Huv." & vbNewLine & "Lub Ntiaj Teb Thoob Ntiaj Teb nce hauv Cov Neeg Muaj Rog Rog tau ua rau muaj kev phom sij txog kev noj qab haus huv raws li Tus Mob Ntawm Tus Kab Mob Hauv Lub Plawv Thiab Mob Ntshav Qab Zib Zoo Li Cas." & vbNewLine & "Txawm hais tias txhua qhov no Muaj coob leej neeg Tsis Paub Txawm Yog Tsis Yog Lawv Rog lossis Yuav Suav Li Cas." & vbNewLine & "Hauv Kev Teb Rau Qhov Peb Tau Ua Lub Tshuab Laij Teb los txiav txim siab koj li BMI thiab Puas Yog lossis Koj Puas Rog." & vbNewLine & "Cov Qauv No Yog Raws Li Lub Koom Haum American Heart Association."

MsgBox (lus)

End Sub Private Sub btnhlp_Click (sender As System. Object, e As System. EventArgs) Handles btnhlp. Click 'add any message you want to write in between the ""' it is empty for now Dim emergency_message As String = ""

MsgBox (nrawm_message)

Xaus SubHoob Kawm Kawg

Kauj Ruam 6: Pab kev zoo siab rau koj txoj kev kawm tiav

tam sim no koj tuaj yeem suav koj li BMI thiab koj paub yuav kho koj li software li cas

ua si software nyem lub xub ntsuab ntawm lub bar sab saud lossis tsuas yog nias F5 txaus siab!

kom koj yooj yim peb tau tshaj tawm peb tus kheej lub laij lej (npaj tau ua) nrog rau lub cajmeem (hauv. txt file)

Pom zoo: