|
Hi. Seems I have some problems when it comes to delete stuff from my listbox.
If someone figures it out for me, please let me know.
Here is the code:
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
''Fjerner tekst i ListBox1'
Dim Item As String
Item = ListBox1.Text
ListBox1.Items.Remove(Item)
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Sier i fra om, når checkbox er krysset av, lagre teksten i listbox'
If CheckBox1.Checked = True Then
Dim item As String
item = TextBox1.Text
ListBox1.Items.Add(item)
End If
End Sub
Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub MaskedTextBox1_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs)
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
End Sub
Private Sub TextBox5_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
End Sub
Private Sub ListBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
'Putter text i valgt text fil'
TextBox6.Text = ListBox1.SelectedItem.ToString
End Sub
End Class
------------------------------
Getting error:
System.NullReferenceException was unhandled
Message="Objektreferanse er ikke satt til en objektforekomst."
Source="Rcon oldis"
StackTrace:
ved WindowsApplication1.Form1.ListBox1_SelectedIndexChanged_1(Object sender, EventArgs e) i C:\Documents and Settings\Finn\Mine dokumenter\Visual Studio 2008\Projects\Rcon oldis\Rcon oldis\Form1.vb:linje 73
ved System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
ved System.Windows.Forms.ListBox.NativeRemoveAt(Int32 index)
ved System.Windows.Forms.ListBox.ObjectCollection.RemoveAt(Int32 index)
ved System.Windows.Forms.ListBox.ObjectCollection.Remove(Object value)
ved WindowsApplication1.Form1.Button3_Click(Object sender, EventArgs e) i C:\Documents and Settings\Finn\Mine dokumenter\Visual Studio 2008\Projects\Rcon oldis\Rcon oldis\Form1.vb:linje 27
ved System.Windows.Forms.Control.OnClick(EventArgs e)
ved System.Windows.Forms.Button.OnClick(EventArgs e)
ved System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
ved System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
ved System.Windows.Forms.Control.WndProc(Message& m)
ved System.Windows.Forms.ButtonBase.WndProc(Message& m)
ved System.Windows.Forms.Button.WndProc(Message& m)
ved System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
ved System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
ved System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
ved System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
ved System.Windows.Forms.Application.ComponentManager.System.Windows.Forms .UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
ved System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int 32 reason, ApplicationContext context)
ved System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
ved System.Windows.Forms.Application.Run(ApplicationContext context)
ved Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase. OnRun()
ved Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase. DoApplicationModel()
ved Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase. Run(String[] commandLine)
ved WindowsApplication1.My.MyApplication.Main(String[] Args) i 17d14f5c-a337-4978-8281-53493378c1071.vb:linje 81
ved System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
ved System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
ved Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
ved System.Threading.ThreadHelper.ThreadStart_Context(Object state)
ved System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
ved System.Threading.ThreadHelper.ThreadStart()
InnerException:
----------------------------------------
when trying to delete something.
|