The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development

Reply
 
Thread Tools Display Modes
Old 02-04-2005, 12:22 PM   #1
Variable Bitrate
 
BiohazrD's Avatar
 
Join Date: Sep 2004
Location: Katy TX
Vehicle: 1994/Dodge/Spirit
Posts: 431
My Photos: (0)
Damn visual basic

Check this out...
Code:
Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form Private fu As Form1 Private WithEvents fs As Form2 Public Shared nick As String Public Shared server As String Private path As String Private sr As StreamReader Private sw As StreamWriter Private socket As New System.Net.Sockets.TcpClient Private connected As Boolean = False Private ss As System.Net.Sockets.NetworkStream Private encrypt As New encryption Private thread As System.Threading.Thread Private rtba(1) As RichTextBox Private lv As Integer #Region " Windows Form Designer generated code " #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load rtba(0) = New RichTextBox TabPage1.Text = "Main" TabControl1.Enabled = False MenuItem6.Enabled = False MenuItem7.Enabled = False path = "pr.dat" fs = New Form2 StatusBar1.Dock = DockStyle.Bottom StatusBar1.Text = "Disconnected" Try If Not File.Exists(path) Then : goSettings() Else sr = New StreamReader(path) nick = sr.ReadLine() server = sr.ReadLine() sr.Close() End If Catch ev As Exception MsgBox("You cannot run this program from a network share") End End Try End Sub Private Sub processinput(ByVal x As String) If x.StartsWith("do>") Then 'process the function ElseIf x.StartsWith("pm>") Then 'send to right index Else : rtba(0).AppendText(x) End If End Sub Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabcontrol1.SelectedIndexChanged mainchatbox = rtba(TabControl1.SelectedIndex()) If Not TabControl1.SelectedIndex = 0 Then MenuItem6.Enabled = True MenuItem7.Enabled = True Else MenuItem6.Enabled = False MenuItem7.Enabled = False End If End Sub Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick TabControl1.Enabled = True If Not ListBox1.SelectedIndex = -1 Then TabControl1.Controls.Add(New TabPage(ListBox1.SelectedIndex.ToString())) ReDim rtba(rtba.Length() + 1) rtba(TabControl1.SelectedIndex()) = New RichTextBox End Sub Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click TabControl1.Controls.RemoveAt(TabControl1.SelectedIndex) For lv = TabControl1.SelectedIndex To TabControl1.TabCount - 1 rtba(lv) = rtba(lv + 1) Next ReDim rtba(rtba.Length() - 1) End Sub Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click save() End End Sub Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click goSettings() End Sub Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click If Not connected Then Try socket.Connect(server, 6667) StatusBar1.Text = "Connected" Button1.Enabled = True MenuItem3.Text = "Disconnect" ss = socket.GetStream thread = New Threading.Thread(AddressOf checkstream) Catch ev As Exception MsgBox("Could not connect to server.", MsgBoxStyle.Exclamation, "Connection Error") End Try Else socket.Close() StatusBar1.Text = "Disconnected" Button1.Enabled = False MenuItem3.Text = "Connect" ss.Close() End If End Sub Shared Sub changeNickWhileConnected(ByVal x As String) 'send new nick to server nick = x End Sub Public Sub f2c() Handles fs.ev Me.Enabled = True save() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click sw.WriteLine(textEnter.Text) textEnter.Text = "" End Sub Private Sub checkstream() If Not sr.Peek = -1 Then : processinput(sr.ReadLine) End If End Sub Private Sub save() sw = New StreamWriter(path) sw.WriteLine(nick) sw.WriteLine(server) sw.Flush() sw.Close() End Sub Public Sub goSettings() fs.TextBox1.Text = nick fs.TextBox2.Text = server If connected Then fs.TextBox2.Enabled = False End If Me.Enabled = False fs.Visible = True End Sub End Class

For some reason, the tab index changed method runs before form_load, and its ******* everything up.
__________________
Quick! To the Popemobile!
BiohazrD is offline   Reply With Quote
Sponsored Links
Old 02-04-2005, 12:39 PM   #2
FLAC
 
IntellaWorks's Avatar
 
Join Date: Jun 2004
Location: NH
Vehicle: 2005 Toyota Tacoma
Posts: 1,173
My Photos: (0)
.

Step through with the debugger go through line for line...

Take a quick break b4 you do it though sometimes walking away for a bit helps...

Good luck
__________________
Progress [I will seriously never be done!]
Via EPIA MII
512MB RAM
OEM GPS (embedded)
nLite WinXP pro on
1GB Extreme III CF card
Carnetix 1260 startup/ DC-DC regulator
Software: Still, re-Writing my existing front end in .Net
IntellaWorks is offline   Reply With Quote
Old 02-04-2005, 01:10 PM   #3
cheap custom title
JC-S60's CarPC Specs
 
JC-S60's Avatar
 
Join Date: Mar 2004
Location: Ghent - Belgium
Vehicle: Volvo V70 | Mitsubishi Canter | BMW R1200GS Adventure | Yamaha YZF600R | Honda CB650
Posts: 1,835
My Photos: (0)
or the ugly fix: doevents
JC-S60 is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Question???? chuckctv Software & Software Development 9 12-28-2004 11:25 AM
FREE Visual Basic .NET SE & ASP.NET Development Book hevnsnt Software & Software Development 3 10-06-2004 10:22 AM
Radio visual basic BT878 NEO Software & Software Development 0 10-31-2003 04:28 PM
Adding Gamepad input in Visual Basic UBCSJonw Software & Software Development 1 09-10-2003 08:00 PM
i need a visual basic OCX for an generic infrared receiver babas151 Software & Software Development 9 04-20-2002 02:10 AM


All times are GMT -5. The time now is 05:46 PM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics