Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hm, no... I am using a TrackBar control, and at whatever position it is at, it will make the transparency. That doesn't seem to work, here's my code:

Dim opace As Integer
       Dim Frm1 As New Form1()
       opace = tbOpacity.Value

       If opace = 1 Then
           Frm1.Opacity = 0.9
       End If
       If opace = 2 Then
           Frm1.Opacity = 0.8
       End If
       If opace = 3 Then
           Frm1.Opacity = 0.7
       End If
       If opace = 4 Then
           Frm1.Opacity = 0.6
       End If
       If opace = 5 Then
           Frm1.Opacity = 0.5
       End If

 

I dunno why this won't work.

Posted (edited)
Fist of all you are using your if control statements wrong. You code makes the program check each and every one even if it finds a match. In some cases you want that but not yours. Use "else if" after your first if. Edited by aewarnick
C#
  • *Experts*
Posted
Why not just use (10 - opace) / 10? Also, you can't just create a new instance of the form as you are doing and change it. You need to modify the current instance of the form using the Me keyword. Try this (in the TrackBar change event):
Me.Opacity = (10 - opace) / 10

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...