/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
HELP ! ! ! simple Visual Basic code ???
Fra : Lasse Madsen


Dato : 07-12-00 19:04

Hi there im making a small resistor color code calculator based on a slider
(SRa) and 4 (shapes a,b,c and d) the shapes is placed like this |a|b|c|d|
after eatch other to symbolise a resistor. what i want is:

make my slider code control the colors of the 4 shapes (a,b,c,d,)
Below is the colour code a resistor can have and which the 4 shapes should
be assigned

Black = &H0&
Brown = &H4080&
Red = &HFF&
Orange = &H80FF&
Yellow = &HFFFF&
Green = &HC000&
Blue = &HFF0000
Purple = &HC000C0
Gray = &H808080
White = &HFFFFFF

Below you see what each colour represents in decimal values
Black = 0
Brown = 1
Red = 2
Orange 3
Yellow = 4
Green = 5
Blue = 6
Purple =7
Gray =8
White ==9

A resistor value is determined like this:
220 Ohms = 2 - 2 - 0 (first and second digit and third value) but when
converted to color code its like this
2 - 2 - 0 =
Red - Red (2 - 2)
the 0 determins how many zeros that is after the 2 digits (in this case 2-2)
and the color code will be RED - RED - BROWN (brown because because you need
1 zero after 2-2 to make 220 !)

If SRa.Value = 3 Then TRa.Text = "220" & " ohms" / this should be 2-2-1
Red-Red-Black
If SRa.Value = 4 Then TRa.Text = "270" & " ohms" /this should be 2-7-1
Red-Purple-Brown


How can i do this ???
--

-------------------------
Electronics Student
Lasse Madsen
Højrupsvej 52, 2.m.f.
9900 Frederikshavn
Denmark



 
 
Njål Fisketjøn (07-12-2000)
Kommentar
Fra : Njål Fisketjøn


Dato : 07-12-00 20:42

On Thu, 7 Dec 2000 19:03:46 +0100, "Lasse Madsen"
<Lasse.Madsen@Elektronik.dk> wrote:

>Hi there im making a small resistor color code calculator based on a slider
>(SRa) and 4 (shapes a,b,c and d) the shapes is placed like this |a|b|c|d|
>after eatch other to symbolise a resistor. what i want is:
>
>make my slider code control the colors of the 4 shapes (a,b,c,d,)
>Below is the colour code a resistor can have and which the 4 shapes should
>be assigned
>
>Black = &H0&
>Brown = &H4080&
>Red = &HFF&
>Orange = &H80FF&
>Yellow = &HFFFF&
>Green = &HC000&
>Blue = &HFF0000
>Purple = &HC000C0
>Gray = &H808080
>White = &HFFFFFF
>
>Below you see what each colour represents in decimal values
>Black = 0
>Brown = 1
>Red = 2
>Orange 3
>Yellow = 4
>Green = 5
>Blue = 6
>Purple =7
>Gray =8
>White ==9
>
>A resistor value is determined like this:
>220 Ohms = 2 - 2 - 0 (first and second digit and third value) but when
>converted to color code its like this
>2 - 2 - 0 =
>Red - Red (2 - 2)
>the 0 determins how many zeros that is after the 2 digits (in this case 2-2)
>and the color code will be RED - RED - BROWN (brown because because you need
>1 zero after 2-2 to make 220 !)
>
>If SRa.Value = 3 Then TRa.Text = "220" & " ohms" / this should be 2-2-1
>Red-Red-Black
>If SRa.Value = 4 Then TRa.Text = "270" & " ohms" /this should be 2-7-1
>Red-Purple-Brown
>

I don't understand the concept of changing the ending 0 to 1, but apart
from that here's some code that might help:

I've put a slider on my form together with 4 shapes, and I've set the
FillStyle property of the shapes to Solid.

Private Sub Slider1_Change()
Dim i As Integer
Dim ColorCode As Variant
Dim cc(9) As Long
Dim strValue As String

i = 0
For Each ColorCode In Array(&H0&, &H4080&, &HFF&, &H80FF&, &HFFFF&,
&HC000&, &HFF0000, &HC000C0, &H808080, &HFFFFFF)
cc(i) = ColorCode
i = i + 1
Next

strValue = Trim$(Str$(Slider1.Value))
For i = 0 To Len(strValue) - 1
If i > Shape1.UBound Then Exit For
Shape1(i).FillColor = cc(Val(Mid$(strValue, i + 1, 1)))
Shape1(i).Visible = True
Next
For i = Len(strValue) To Shape1.UBound
Shape1(i).Visible = False
Next
End Sub



ton (08-12-2000)
Kommentar
Fra : ton


Dato : 08-12-00 22:46

Public x As Integer
Public va As String

Private Sub Form_Load()
x = 0
End Sub

Private Sub Text3_Click(Index As Integer)
nr = Text3(Index).Index
If x = 3 Then
For t = 0 To 2: Text1(t).BackColor = &H80000005: Next
x = 0
va = ""
End If
Text1(x).BackColor = Text3(nr).BackColor
x = x + 1
Select Case x
Case 1
va = CStr(nr) & va
Case 2
va = va & CStr(nr)
Case 3
Select Case nr
Case 0
va = va & "0 ohm"
Case 1
va = va & "0 ohm"
Case 2
va = va & "00 ohm"
Case 3
va = va & " K ohm"
Case 4
va = va & "0 Kohm"
Case 5
va = va & " M ohm"
End Select
End Select
Text2.Text = va
End Sub
The form consists of a textbox 'text2.text', 3 small(1 character) textboxes
text1(0).text etc and 10 small textboxes text3(0..9) with the colors you
describe as backcolor.
Nice idea, works simple. I'll send you the form if you want.
regards, ton
Lasse Madsen <Lasse.Madsen@Elektronik.dk> schreef in berichtnieuws
90oika$143u$1@news.cybercity.dk...
> Hi there im making a small resistor color code calculator based on a
slider
> (SRa) and 4 (shapes a,b,c and d) the shapes is placed like this |a|b|c|d|
> after eatch other to symbolise a resistor. what i want is:
>
> make my slider code control the colors of the 4 shapes (a,b,c,d,)
> Below is the colour code a resistor can have and which the 4 shapes should
> be assigned
>
> Black = &H0&
> Brown = &H4080&
> Red = &HFF&
> Orange = &H80FF&
> Yellow = &HFFFF&
> Green = &HC000&
> Blue = &HFF0000
> Purple = &HC000C0
> Gray = &H808080
> White = &HFFFFFF
>
> Below you see what each colour represents in decimal values
> Black = 0
> Brown = 1
> Red = 2
> Orange 3
> Yellow = 4
> Green = 5
> Blue = 6
> Purple =7
> Gray =8
> White ==9
>
> A resistor value is determined like this:
> 220 Ohms = 2 - 2 - 0 (first and second digit and third value) but when
> converted to color code its like this
> 2 - 2 - 0 =
> Red - Red (2 - 2)
> the 0 determins how many zeros that is after the 2 digits (in this case
2-2)
> and the color code will be RED - RED - BROWN (brown because because you
need
> 1 zero after 2-2 to make 220 !)
>
> If SRa.Value = 3 Then TRa.Text = "220" & " ohms" / this should be 2-2-1
> Red-Red-Black
> If SRa.Value = 4 Then TRa.Text = "270" & " ohms" /this should be 2-7-1
> Red-Purple-Brown
>
>
> How can i do this ???
> --
>
> -------------------------
> Electronics Student
> Lasse Madsen
> Højrupsvej 52, 2.m.f.
> 9900 Frederikshavn
> Denmark
>
>



Lasse Madsen (11-12-2000)
Kommentar
Fra : Lasse Madsen


Dato : 11-12-00 03:04

Dear Ton

I would wery much appriciate the form project if you will send it to me, If
its possible i would like 2 independent resistor calculators on that one
form, Cause the project that im making requres 2 independent resistor values
to be shown in colour code

Thanks alot
Regards
Lasse Madsen
Denmark

"ton" <zoetermeer@xs4all.nl> skrev i en meddelelse
news:90rkbe$i4k$1@news1.xs4all.nl...
> Public x As Integer
> Public va As String
>
> Private Sub Form_Load()
> x = 0
> End Sub
>
> Private Sub Text3_Click(Index As Integer)
> nr = Text3(Index).Index
> If x = 3 Then
> For t = 0 To 2: Text1(t).BackColor = &H80000005: Next
> x = 0
> va = ""
> End If
> Text1(x).BackColor = Text3(nr).BackColor
> x = x + 1
> Select Case x
> Case 1
> va = CStr(nr) & va
> Case 2
> va = va & CStr(nr)
> Case 3
> Select Case nr
> Case 0
> va = va & "0 ohm"
> Case 1
> va = va & "0 ohm"
> Case 2
> va = va & "00 ohm"
> Case 3
> va = va & " K ohm"
> Case 4
> va = va & "0 Kohm"
> Case 5
> va = va & " M ohm"
> End Select
> End Select
> Text2.Text = va
> End Sub
> The form consists of a textbox 'text2.text', 3 small(1 character)
textboxes
> text1(0).text etc and 10 small textboxes text3(0..9) with the colors you
> describe as backcolor.
> Nice idea, works simple. I'll send you the form if you want.
> regards, ton
> Lasse Madsen <Lasse.Madsen@Elektronik.dk> schreef in berichtnieuws
> 90oika$143u$1@news.cybercity.dk...
> > Hi there im making a small resistor color code calculator based on a
> slider
> > (SRa) and 4 (shapes a,b,c and d) the shapes is placed like this
|a|b|c|d|
> > after eatch other to symbolise a resistor. what i want is:
> >
> > make my slider code control the colors of the 4 shapes (a,b,c,d,)
> > Below is the colour code a resistor can have and which the 4 shapes
should
> > be assigned
> >
> > Black = &H0&
> > Brown = &H4080&
> > Red = &HFF&
> > Orange = &H80FF&
> > Yellow = &HFFFF&
> > Green = &HC000&
> > Blue = &HFF0000
> > Purple = &HC000C0
> > Gray = &H808080
> > White = &HFFFFFF
> >
> > Below you see what each colour represents in decimal values
> > Black = 0
> > Brown = 1
> > Red = 2
> > Orange 3
> > Yellow = 4
> > Green = 5
> > Blue = 6
> > Purple =7
> > Gray =8
> > White ==9
> >
> > A resistor value is determined like this:
> > 220 Ohms = 2 - 2 - 0 (first and second digit and third value) but when
> > converted to color code its like this
> > 2 - 2 - 0 =
> > Red - Red (2 - 2)
> > the 0 determins how many zeros that is after the 2 digits (in this case
> 2-2)
> > and the color code will be RED - RED - BROWN (brown because because you
> need
> > 1 zero after 2-2 to make 220 !)
> >
> > If SRa.Value = 3 Then TRa.Text = "220" & " ohms" / this should be
2-2-1
> > Red-Red-Black
> > If SRa.Value = 4 Then TRa.Text = "270" & " ohms" /this should be 2-7-1
> > Red-Purple-Brown
> >
> >
> > How can i do this ???
> > --
> >
> > -------------------------
> > Electronics Student
> > Lasse Madsen
> > Højrupsvej 52, 2.m.f.
> > 9900 Frederikshavn
> > Denmark
> >
> >
>
>



CMS (13-01-2001)
Kommentar
Fra : CMS


Dato : 13-01-01 00:08

I would also like a copy of the project if possible. I too am into
electronics and amateur radio and I think this would be a fun project to
play with!

Nis Madsen
USA, NJ
screensavers4u@hotmail.com
Lasse Madsen <Lasse.Madsen@Elektronik.dk> wrote in message
news:911btb$7lo$1@news.cybercity.dk...
> Dear Ton
>
> I would wery much appriciate the form project if you will send it to me,
If
> its possible i would like 2 independent resistor calculators on that one
> form, Cause the project that im making requres 2 independent resistor
values
> to be shown in colour code
>
> Thanks alot
> Regards
> Lasse Madsen
> Denmark
>
> "ton" <zoetermeer@xs4all.nl> skrev i en meddelelse
> news:90rkbe$i4k$1@news1.xs4all.nl...
> > Public x As Integer
> > Public va As String
> >
> > Private Sub Form_Load()
> > x = 0
> > End Sub
> >
> > Private Sub Text3_Click(Index As Integer)
> > nr = Text3(Index).Index
> > If x = 3 Then
> > For t = 0 To 2: Text1(t).BackColor = &H80000005: Next
> > x = 0
> > va = ""
> > End If
> > Text1(x).BackColor = Text3(nr).BackColor
> > x = x + 1
> > Select Case x
> > Case 1
> > va = CStr(nr) & va
> > Case 2
> > va = va & CStr(nr)
> > Case 3
> > Select Case nr
> > Case 0
> > va = va & "0 ohm"
> > Case 1
> > va = va & "0 ohm"
> > Case 2
> > va = va & "00 ohm"
> > Case 3
> > va = va & " K ohm"
> > Case 4
> > va = va & "0 Kohm"
> > Case 5
> > va = va & " M ohm"
> > End Select
> > End Select
> > Text2.Text = va
> > End Sub
> > The form consists of a textbox 'text2.text', 3 small(1 character)
> textboxes
> > text1(0).text etc and 10 small textboxes text3(0..9) with the colors you
> > describe as backcolor.
> > Nice idea, works simple. I'll send you the form if you want.
> > regards, ton
> > Lasse Madsen <Lasse.Madsen@Elektronik.dk> schreef in berichtnieuws
> > 90oika$143u$1@news.cybercity.dk...
> > > Hi there im making a small resistor color code calculator based on a
> > slider
> > > (SRa) and 4 (shapes a,b,c and d) the shapes is placed like this
> |a|b|c|d|
> > > after eatch other to symbolise a resistor. what i want is:
> > >
> > > make my slider code control the colors of the 4 shapes (a,b,c,d,)
> > > Below is the colour code a resistor can have and which the 4 shapes
> should
> > > be assigned
> > >
> > > Black = &H0&
> > > Brown = &H4080&
> > > Red = &HFF&
> > > Orange = &H80FF&
> > > Yellow = &HFFFF&
> > > Green = &HC000&
> > > Blue = &HFF0000
> > > Purple = &HC000C0
> > > Gray = &H808080
> > > White = &HFFFFFF
> > >
> > > Below you see what each colour represents in decimal values
> > > Black = 0
> > > Brown = 1
> > > Red = 2
> > > Orange 3
> > > Yellow = 4
> > > Green = 5
> > > Blue = 6
> > > Purple =7
> > > Gray =8
> > > White ==9
> > >
> > > A resistor value is determined like this:
> > > 220 Ohms = 2 - 2 - 0 (first and second digit and third value) but when
> > > converted to color code its like this
> > > 2 - 2 - 0 =
> > > Red - Red (2 - 2)
> > > the 0 determins how many zeros that is after the 2 digits (in this
case
> > 2-2)
> > > and the color code will be RED - RED - BROWN (brown because because
you
> > need
> > > 1 zero after 2-2 to make 220 !)
> > >
> > > If SRa.Value = 3 Then TRa.Text = "220" & " ohms" / this should be
> 2-2-1
> > > Red-Red-Black
> > > If SRa.Value = 4 Then TRa.Text = "270" & " ohms" /this should be
2-7-1
> > > Red-Purple-Brown
> > >
> > >
> > > How can i do this ???
> > > --
> > >
> > > -------------------------
> > > Electronics Student
> > > Lasse Madsen
> > > Højrupsvej 52, 2.m.f.
> > > 9900 Frederikshavn
> > > Denmark
> > >
> > >
> >
> >
>
>



Søg
Reklame
Statistik
Spørgsmål : 177513
Tips : 31968
Nyheder : 719565
Indlæg : 6408601
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste