If My.Forms.Main_frm.UseProxy.Checked = True Then
                My.Forms.Main_frm.IPBindingTextbox.Enabled = True
                My.Forms.Main_frm.ProxyIPTextbox.Enabled = True
                My.Forms.Main_frm.SocksV4.Enabled = True
                My.Forms.Main_frm.SocksV5.Enabled = True
                My.Forms.Main_frm.ProxyUser.Enabled = True
                My.Forms.Main_frm.ProxyPw.Enabled = True
            ElseIf My.Forms.Main_frm.UseProxy.Checked = False Then
                My.Forms.Main_frm.IPBindingTextbox.Enabled = False
                My.Forms.Main_frm.ProxyIPTextbox.Enabled = False
                My.Forms.Main_frm.SocksV4.Enabled = False
                My.Forms.Main_frm.SocksV5.Enabled = False
                My.Forms.Main_frm.ProxyUser.Enabled = False
                My.Forms.Main_frm.ProxyPw.Enabled = False
            End If

Is there a better way to do that? (By better i mean same result and less lines)

Put the controls you are enabling/disabling in a container control (panel or group) if possible. Then just enable or disable that one. The child controls will be enabled/disabled as well.

commented: Yea, its what i had to do. +1

Or if you can't or don't want to group the controls, set the Tag property of each to some known value then test in a loop like

For Each ctrl As Control In Me.Controls
    If ctrl.Tag = "my value" Then
        ctrl.Enabled = True
    End If
Next
commented: Thank you for providing the code +1
For Each phControl As Control In My.Forms.Main_frm.PhGroupBox1.Controls
    If phControl.Tag = "SocksTag" Then
       phControl.Enabled = Not phControl.Enabled
    End If
Next

Thank you, way faster and shorter :)
Voting and Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.