Click here to Skip to main content
16,010,268 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionvb.net - login on to site web Pin
seven.75-Apr-07 20:56
seven.75-Apr-07 20:56 
Questionconnection with web cam Pin
kripa215-Apr-07 19:22
kripa215-Apr-07 19:22 
AnswerRe: connection with web cam Pin
Dave Kreskowiak6-Apr-07 3:59
mveDave Kreskowiak6-Apr-07 3:59 
QuestionHelp!!! Declare a varied-length array of structures and the use of marshalling? Pin
peary5-Apr-07 18:17
peary5-Apr-07 18:17 
Questioncrystalreport problem Pin
kittipomgmd5-Apr-07 16:46
kittipomgmd5-Apr-07 16:46 
AnswerRe: crystalreport problem Pin
Member 38798816-Apr-07 1:02
Member 38798816-Apr-07 1:02 
QuestionStreamReader Writer problem Pin
f_soto5-Apr-07 15:31
f_soto5-Apr-07 15:31 
QuestionStreamReader Writer problem Pin
f_soto5-Apr-07 15:29
f_soto5-Apr-07 15:29 
Hello all i am having problem with the stream class, i am new to vb.net. Problem i have is as follows: cannot figure out for the life of me how to get this simple task going, writing using the stream to txt file is replacing the previouse entries instead of adding to the txt file. Next my cboBox is not updating with the info or populating the txt boxes with info from cboBox. I have a cboBox with 1-31 in it(days of month). For each day i need to store some numeric data tied to each day, well not working on mine, or better said dont know how to do it.. Help please..the code is as follows..

Option Strict On
Imports System.IO

Public Class Form1
Inherits System.Windows.Forms.Form

'Declare module-level variables
Private mblnIsDirty As Boolean

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFecha.SelectedIndexChanged
'Dim test As Integer
'Dim datServicio As New StreamReader("Servicio.txt")
'For test = 1 To 31
' cboFecha.Items.Add(test)
'Next
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load the items in teh cboFecha list
Dim dgrResponse As DialogResult

Try
'Open the file
Dim datServicio As New StreamReader("Servicio.txt")
'Read all elements into the list
Do Until datServicio.Peek = -1
cboFecha.Items.Add(datServicio.ReadLine())
txtLibros.Text = datServicio.ReadLine()
txtFolletos.Text = datServicio.ReadLine()
txtHorasH.Text = datServicio.ReadLine()
txtHorasM.Text = datServicio.ReadLine()
txtRev.Text = datServicio.ReadLine()
txtRvsitas.Text = datServicio.ReadLine()
Loop

'Close the file
datServicio.Close()
Catch 'File missing
dgrResponse = MessageBox.Show("Create a new file?", "File not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If dgrResponse = DialogResult.No Then
btnExit_Click(sender, e) 'Exit the program
End If
End Try

txtTotalLibros.Enabled = False
txtTotalFolletos.Enabled = False
txtTotalHorasH.Enabled = False
txtTotalHorasM.Enabled = False
txtTotalRev.Enabled = False
txtTotalRvsitas.Enabled = False
cboFecha.Focus()
End Sub

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Save the list box contents in a file
Dim datServicio As New StreamWriter("Servicio.txt") 'Open the file
Dim intIndex As Integer
Dim IntMaximum As Integer

datServicio.WriteLine(cboFecha.SelectedIndex + 1)
'Next intIndex

With cboFecha
If .SelectedIndex <> -1 Then
datServicio.WriteLine(cboFecha.Text)
Else
MessageBox.Show("Select a Day", "No selection made", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End With

datServicio.WriteLine(txtLibros.Text)
datServicio.WriteLine(txtFolletos.Text)
datServicio.WriteLine(txtHorasH.Text)
datServicio.WriteLine(txtHorasM.Text)
datServicio.WriteLine(txtRev.Text)
datServicio.WriteLine(txtRvsitas.Text)

datServicio.Close() 'Close the file
mblnIsDirty = True
'Clears the cbo and txt boxes

cboFecha.Text = ""
txtLibros.Text = ""
txtFolletos.Text = ""
txtHorasH.Text = ""
txtHorasM.Text = ""
txtRev.Text = ""
txtRvsitas.Text = ""
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'Terminates the project
Me.Close()
End Sub

Private Sub btnNewMonth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewMonth.Click
Dim datServicio As New StreamWriter("Servicio.txt")
'Closes the file
'datServicio.Close()
mblnIsDirty = False
'Opens the file
'Dim datServicio As New StreamWriter("Servicio.txt")
'Erases the Servicio.txt file
datServicio.Flush()
End Sub
End Class

Thanks Francisco....Frown | :(

AnswerRe: StreamReader Writer problem Pin
Dave Kreskowiak6-Apr-07 3:58
mveDave Kreskowiak6-Apr-07 3:58 
GeneralRe: StreamReader Writer problem Pin
f_soto6-Apr-07 18:38
f_soto6-Apr-07 18:38 
GeneralRe: StreamReader Writer problem Pin
Dave Kreskowiak7-Apr-07 5:43
mveDave Kreskowiak7-Apr-07 5:43 
GeneralRe: StreamReader Writer problem Pin
f_soto7-Apr-07 10:10
f_soto7-Apr-07 10:10 
GeneralRe: StreamReader Writer problem Pin
Dave Kreskowiak8-Apr-07 4:38
mveDave Kreskowiak8-Apr-07 4:38 
Questionw to Frozen DGV columns Pin
cstrader2325-Apr-07 15:13
cstrader2325-Apr-07 15:13 
AnswerRe: w to Frozen DGV columns Pin
Dave Kreskowiak6-Apr-07 3:44
mveDave Kreskowiak6-Apr-07 3:44 
GeneralRe: w to Frozen DGV columns Pin
cstrader2326-Apr-07 4:03
cstrader2326-Apr-07 4:03 
GeneralRe: w to Frozen DGV columns Pin
Dave Kreskowiak6-Apr-07 4:27
mveDave Kreskowiak6-Apr-07 4:27 
GeneralRe: w to Frozen DGV columns Pin
cstrader2326-Apr-07 4:33
cstrader2326-Apr-07 4:33 
Questionhow to build a trial version of an application? Pin
Mr.Kode5-Apr-07 11:14
Mr.Kode5-Apr-07 11:14 
AnswerRe: how to build a trial version of an application? Pin
Dave Kreskowiak6-Apr-07 3:47
mveDave Kreskowiak6-Apr-07 3:47 
GeneralRe: how to build a trial version of an application? Pin
Mr.Kode6-Apr-07 11:13
Mr.Kode6-Apr-07 11:13 
AnswerRe: how to build a trial version of an application? Pin
Thomas Stockwell6-Apr-07 15:51
professionalThomas Stockwell6-Apr-07 15:51 
GeneralRe: how to build a trial version of an application? Pin
Mr.Kode6-Apr-07 20:56
Mr.Kode6-Apr-07 20:56 
AnswerRe: how to build a trial version of an application? Pin
zwaailicht29-Nov-07 10:13
zwaailicht29-Nov-07 10:13 
QuestionHelp! Can anyone give me a simple code about drawing Metafile (use the memorystream)? Pin
astcws5-Apr-07 9:55
astcws5-Apr-07 9:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.