Hirdetés

2024. május 2., csütörtök

Gyorskeresés

Útvonal

Fórumok  »  Szoftverfejlesztés  »  Visual Basic

Hozzászólások

(#85) Wasmacsó


Wasmacsó
csendes tag


Hi! Tudnátok nekem segíteni? VB.net - ben írtam progit és mindíg azt mondja hogy: An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Enum value was out of legal range.

Persze ha rákattintok a gombra, mert a Form_Load - nál nem írhja ki hogy hiba lenne, csak a Button4_Click vagy a Button5_Click - nél!

Ez itt a kód:

Imports System.IO
Imports System
Public Class Form1
Inherits System.Windows.Forms.Form

#Region '' Windows Form Designer generated code ''

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents MonthCalendar1 As System.Windows.Forms.MonthCalendar
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Public WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents ErrorProvider1 As System.Windows.Forms.ErrorProvider
Friend WithEvents Admin As System.Windows.Forms.NotifyIcon
Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar
Me.StatusBar1 = New System.Windows.Forms.StatusBar
Me.Label6 = New System.Windows.Forms.Label
Me.Label7 = New System.Windows.Forms.Label
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.Admin = New System.Windows.Forms.NotifyIcon(Me.components)
Me.HelpProvider1 = New System.Windows.Forms.HelpProvider
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.ErrorProvider1 = New System.Windows.Forms.ErrorProvider
Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
Me.Label8 = New System.Windows.Forms.Label
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Timer1
'
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font(''Microsoft Sans Serif'', 48.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(238, Byte))
Me.Label1.Location = New System.Drawing.Point(24, 32)
Me.Label1.Name = ''Label1''
Me.Label1.Size = New System.Drawing.Size(464, 80)
Me.Label1.TabIndex = 0
'
'TextBox1
'
Me.TextBox1.Enabled = False
Me.TextBox1.Location = New System.Drawing.Point(72, 120)
Me.TextBox1.Name = ''TextBox1''
Me.TextBox1.Size = New System.Drawing.Size(40, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ''''
'
'TextBox2
'
Me.TextBox2.Enabled = False
Me.TextBox2.Location = New System.Drawing.Point(128, 120)
Me.TextBox2.Name = ''TextBox2''
Me.TextBox2.Size = New System.Drawing.Size(24, 20)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Text = ''''
'
'TextBox3
'
Me.TextBox3.Enabled = False
Me.TextBox3.Location = New System.Drawing.Point(168, 120)
Me.TextBox3.Name = ''TextBox3''
Me.TextBox3.Size = New System.Drawing.Size(40, 20)
Me.TextBox3.TabIndex = 3
Me.TextBox3.Text = ''''
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(376, 120)
Me.Button1.Name = ''Button1''
Me.Button1.Size = New System.Drawing.Size(112, 40)
Me.Button1.TabIndex = 4
Me.Button1.Text = ''Óra indul!''
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(216, 120)
Me.RadioButton1.Name = ''RadioButton1''
Me.RadioButton1.Size = New System.Drawing.Size(136, 16)
Me.RadioButton1.TabIndex = 5
Me.RadioButton1.Text = ''engedélyezés''
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(216, 144)
Me.RadioButton2.Name = ''RadioButton2''
Me.RadioButton2.Size = New System.Drawing.Size(152, 16)
Me.RadioButton2.TabIndex = 6
Me.RadioButton2.Text = ''nincs engedélyezés''
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 120)
Me.Label2.Name = ''Label2''
Me.Label2.Size = New System.Drawing.Size(64, 16)
Me.Label2.TabIndex = 7
Me.Label2.Text = ''Jelzés:''
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(112, 120)
Me.Label3.Name = ''Label3''
Me.Label3.Size = New System.Drawing.Size(8, 24)
Me.Label3.TabIndex = 8
Me.Label3.Text = '':''
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(160, 120)
Me.Label4.Name = ''Label4''
Me.Label4.Size = New System.Drawing.Size(8, 16)
Me.Label4.TabIndex = 9
Me.Label4.Text = '':''
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(8, 168)
Me.Label5.Name = ''Label5''
Me.Label5.Size = New System.Drawing.Size(88, 24)
Me.Label5.TabIndex = 10
Me.Label5.Text = ''Üzenet:''
'
'TextBox4
'
Me.TextBox4.Enabled = False
Me.TextBox4.Location = New System.Drawing.Point(56, 168)
Me.TextBox4.Name = ''TextBox4''
Me.TextBox4.Size = New System.Drawing.Size(128, 20)
Me.TextBox4.TabIndex = 11
Me.TextBox4.Text = ''''
'
'MonthCalendar1
'
Me.MonthCalendar1.Location = New System.Drawing.Point(440, 176)
Me.MonthCalendar1.Name = ''MonthCalendar1''
Me.MonthCalendar1.TabIndex = 12
'
'StatusBar1
'
Me.StatusBar1.Location = New System.Drawing.Point(0, 381)
Me.StatusBar1.Name = ''StatusBar1''
Me.StatusBar1.Size = New System.Drawing.Size(608, 16)
Me.StatusBar1.TabIndex = 13
Me.StatusBar1.Text = ''Ready''
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(24, 8)
Me.Label6.Name = ''Label6''
Me.Label6.Size = New System.Drawing.Size(72, 16)
Me.Label6.TabIndex = 14
Me.Label6.Text = ''Óra:''
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(8, 200)
Me.Label7.Name = ''Label7''
Me.Label7.Size = New System.Drawing.Size(72, 24)
Me.Label7.TabIndex = 15
Me.Label7.Text = ''Esemény:''
'
'ComboBox1
'
Me.ComboBox1.Items.AddRange(New Object() {''Üzenet küldése programnak: Notepad '', ''Üzenet küldése programnak: Cmd '', ''Üzenet küldése programnak: MSWORD '', ''Üzenet küldése programnak: Messanger '', ''Üzenet küldése programnak: TextPad '', ''Üzenet küldése programnak: Internet Explorer ''})
Me.ComboBox1.Location = New System.Drawing.Point(8, 232)
Me.ComboBox1.Name = ''ComboBox1''
Me.ComboBox1.Size = New System.Drawing.Size(248, 21)
Me.ComboBox1.TabIndex = 16
Me.ComboBox1.Text = ''Válassz! ''
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(8, 272)
Me.TextBox5.Name = ''TextBox5''
Me.TextBox5.Size = New System.Drawing.Size(256, 20)
Me.TextBox5.TabIndex = 17
Me.TextBox5.Text = ''Program paraméterek''
'
'Admin
'
Me.Admin.Icon = CType(resources.GetObject(''Admin.Icon''), System.Drawing.Icon)
Me.Admin.Text = ''Admin''
Me.Admin.Visible = True
'
'HelpProvider1
'
Me.HelpProvider1.HelpNamespace = CType(configurationAppSettings.GetValue(''HelpProvider1.Help
Namespace'', GetType(System.String)), String)
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(8, 304)
Me.RichTextBox1.Name = ''RichTextBox1''
Me.RichTextBox1.Size = New System.Drawing.Size(240, 40)
Me.RichTextBox1.TabIndex = 18
Me.RichTextBox1.Text = ''Jegyzetek''
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(256, 304)
Me.Button2.Name = ''Button2''
Me.Button2.Size = New System.Drawing.Size(72, 16)
Me.Button2.TabIndex = 19
Me.Button2.Text = ''Mentés''
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(256, 320)
Me.Button3.Name = ''Button3''
Me.Button3.Size = New System.Drawing.Size(72, 16)
Me.Button3.TabIndex = 20
Me.Button3.Text = ''Megnyitás''
'
'ErrorProvider1
'
Me.ErrorProvider1.ContainerControl = Me
'
'DateTimePicker1
'
Me.DateTimePicker1.Location = New System.Drawing.Point(440, 344)
Me.DateTimePicker1.Name = ''DateTimePicker1''
Me.DateTimePicker1.Size = New System.Drawing.Size(168, 20)
Me.DateTimePicker1.TabIndex = 21
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(8, 352)
Me.Label8.Name = ''Label8''
Me.Label8.Size = New System.Drawing.Size(184, 16)
Me.Label8.TabIndex = 22
Me.Label8.Text = ''az ön születésnapja:''
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(112, 352)
Me.TextBox6.Name = ''TextBox6''
Me.TextBox6.Size = New System.Drawing.Size(128, 20)
Me.TextBox6.TabIndex = 23
Me.TextBox6.Text = ''''
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(256, 344)
Me.Button4.Name = ''Button4''
Me.Button4.Size = New System.Drawing.Size(64, 24)
Me.Button4.TabIndex = 24
Me.Button4.Text = ''OK''
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(328, 344)
Me.Button5.Name = ''Button5''
Me.Button5.Size = New System.Drawing.Size(96, 24)
Me.Button5.TabIndex = 25
Me.Button5.Text = ''Megváltoztatás''
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(608, 397)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.DateTimePicker1)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.RichTextBox1)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.ComboBox1)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.StatusBar1)
Me.Controls.Add(Me.MonthCalendar1)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.RadioButton2)
Me.Controls.Add(Me.RadioButton1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Icon = CType(resources.GetObject(''$this.Icon''), System.Drawing.Icon)
Me.Name = ''Form1''
Me.Text = ''Admin''
Me.ResumeLayout(False)

End Sub

#End Region
Dim blnAlarm As Boolean

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
If TextBox1.Text '''' And TextBox2.Text '''' And TextBox3.Text '''' Then
Dim AlarmTime = New DateTime(Today.Year, Today.Month, Today.Day, CInt(TextBox1.Text), CInt(TextBox2.Text), CInt(TextBox3.Text))
If Now > AlarmTime And blnAlarm Then
Beep()
MsgBox(TextBox4.Text, MsgBoxStyle.OKOnly, ''Jelzés!'')
Beep()
Timer1.Enabled = False
Timer1.Stop()
Timer1.Dispose()
ElseIf ComboBox1.SelectedItem = ComboBox1.Items(0) And Now > AlarmTime Then
AppActivate(''Névtelen - Jegyzettömb'')
System.Windows.Forms.SendKeys.Send(TextBox4.Text)
Timer1.Enabled = False
Timer1.Stop()
Timer1.Dispose()
End If
End If
If ComboBox1.SelectedItem = ComboBox1.Items(0) Or ComboBox1.SelectedItem = ComboBox1.Items(1) Or ComboBox1.SelectedItem = ComboBox1.Items(2) Or ComboBox1.SelectedItem = ComboBox1.Items(3) Then
blnAlarm = False
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim u As New System.IO.FileStream(''bday.txt'', IO.FileMode.Open)
Dim w As New System.IO.StreamReader(u)
Timer1.Enabled = True
If TextBox1.Text = ''Joci'' Or TextBox2.Text = ''Joci'' Or TextBox3.Text = ''Joci'' Or TextBox4.Text = ''Joci'' Or TextBox5.Text = ''Joci'' Then
MsgBox(''Virus detected in text: 'Joci'. The program run stopped'', MsgBoxStyle.Critical, ''Virus detected'')

Me.Close()
End If
StatusBar1.Text = ''Timer Started''
If DateTimePicker1.Text = w.ReadToEnd() Then
MsgBox(''Boldog szülinapot!'')
w.Close()
End If

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked Then
blnAlarm = True
TextBox4.Enabled = True
TextBox2.Enabled = True
TextBox1.Enabled = True
TextBox3.Enabled = True
ElseIf TextBox4.Text = '''' And TextBox4.Enabled And Label1.Text = TimeOfDay Then
TextBox4.Text = ''Jelzés!''
End If
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked Then
blnAlarm = False
TextBox4.Enabled = False
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = False
If RadioButton1.Checked And RadioButton2.Checked Then
StatusBar1.Text = ''error!''
End If
HelpProvider1.SetHelpKeyword(Me, ''F1'')

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim result As Integer
If SaveFileDialog1.ShowDialog Then
RichTextBox1.SaveFile(SaveFileDialog1.FileName)
SaveFileDialog1.Title = ''Save file (only rtf format)''
SaveFileDialog1.Filter = ''*.rtf''
ElseIf result = DialogResult.Cancel Or SaveFileDialog1.FileName = '''' Then
SaveFileDialog1.AddExtension = True
RichTextBox1.Text = ''Jegyzetek''
ErrorProvider1.SetError(Me, ''Error!'')
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim r As Integer
If OpenFileDialog1.ShowDialog Then
RichTextBox1.LoadFile(OpenFileDialog1.FileName)
OpenFileDialog1.Filter = ''*.rtf''
OpenFileDialog1.OpenFile()
End If
End Sub


Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim t As New System.IO.FileStream(''bday.txt'', IO.FileMode.Append And IO.FileMode.Open And IO.FileMode.CreateNew And IO.FileMode.Create)
Dim z As New System.IO.StreamWriter(t)
z.BaseStream.Seek(0, IO.SeekOrigin.End)
z.WriteLine(TextBox6.Text)
z.Close()
End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
If DateTimePicker1.Text = ''2004. december 6.'' Then
MsgBox(''Akkor jön a mikulás!'', MsgBoxStyle.Information, ''Miki'')
ElseIf DateTimePicker1.Text = ''2004. december 24.'' Then
MsgBox(''Szenteste!'', MsgBoxStyle.Information, ''Karácsony'')
End If
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim g As New System.IO.FileStream(''bday.txt'', IO.FileMode.Append And IO.FileMode.Open And IO.FileMode.CreateNew And IO.FileMode.Create)
Dim s As New System.IO.StreamWriter(g)
s.BaseStream.Seek(0, IO.SeekOrigin.End)
s.NewLine.Remove(s.NewLine.Length, s.NewLine.Length)
s.WriteLine(TextBox6.Text)
End Sub
End Class

Help for me pls!

Wasfitymájú kapanyányimonyók

Útvonal

Fórumok  »  Szoftverfejlesztés  »  Visual Basic
Copyright © 2000-2024 PROHARDVER Informatikai Kft.