Click here to Skip to main content
16,004,977 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Window Form Location vb.net2005 Pin
Tom Deketelaere23-Oct-07 20:41
professionalTom Deketelaere23-Oct-07 20:41 
GeneralRe: Window Form Location vb.net2005 Pin
aransiola24-Oct-07 9:34
aransiola24-Oct-07 9:34 
QuestionCode Is Not Working . Pin
Dan Suthar23-Oct-07 6:15
professionalDan Suthar23-Oct-07 6:15 
AnswerRe: Code Is Not Working . Pin
pmarfleet23-Oct-07 6:56
pmarfleet23-Oct-07 6:56 
AnswerRe: Code Is Not Working . Pin
Scott Dorman23-Oct-07 7:12
professionalScott Dorman23-Oct-07 7:12 
GeneralRe: Code Is Not Working . Pin
Dan Suthar24-Oct-07 6:22
professionalDan Suthar24-Oct-07 6:22 
GeneralRe: Code Is Not Working . Pin
Scott Dorman24-Oct-07 12:34
professionalScott Dorman24-Oct-07 12:34 
QuestionText Problem Pin
saldarius23-Oct-07 5:56
saldarius23-Oct-07 5:56 
Hi.I'm David Dlaka.

The Problem
Im making a projet with text files.There is a textbox in which you type some text.There are 3 buttons.Save,Open and Close.I'm having problem with the Save function.When you click save,an inputbox pops out and you need to type a code in it,so your files are secured.In the programming code the saving code is defined as "Short" ,but when i save it says:"Cast from string "mycode" to type 'Short' is not valid".Even if i change short with long,string integer or similar,it says tthe same thing!What do i do?Confused | :confused:

The code
This is the whole code

PrivateSub mnuSaveAsItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles mnuSaveAsItem.Click<br />
Dim letter As Char Dim lngCode As Short <br />
Dim i, charsInFile As Long <br />
Dim Code As Short <br />
SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"<br />
SaveFileDialog1.ShowDialog()<br />
If SaveFileDialog1.FileName <> "" Then <br />
lngCode = InputBox("Insert code to code the file.")<br />
If lngCode = "" Then Exit Sub <br />
Code = charsInFile = Txtnote.Text.Length<br />
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)<br />
letter = Txtnote.Text.Substring(i, 1)<br />
Print(1, Asc(letter) <br />
CShort(lngCode)For i = 0 To charsInFile - 1Xor Code)Next <br />
FileClose(1)<br />
mnuCloseItem.Enabled = True End If End Sub Private Sub mnuCloseItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCloseItem.ClickDim a As String <br />
a = InputBox("Did you save?")<br />
If a = ("Yes") Or a = ("yes") Then <br />
Txtnote.Text = ""<br />
ElseIf a = ("No") Or a = ("no") Then <br />
MsgBox("Don't forget to save your file first")<br />
Else <br />
MsgBox("Please answer with ""Yes"" or ""No""")<br />
End If <br />
End Sub <br />
Private Sub mnuOpenItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuOpenItem.ClickDim CelTekst, LinijaNaTekst As String Dim lngCode As Short <br />
OpenFileDialog1.Filter = "Text files (*.TXT)|*.TXT"<br />
OpenFileDialog1.ShowDialog()<br />
Dim Code As Short If OpenFileDialog1.FileName <> "" Then Try <br />
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)<br />
LinijaNaTekst = LineInput(1)<br />
CelTekst = CelTekst & LinijaNaTekst & vbCrLf<br />
Do Until EOF(1)Loop <br />
Txtnote.Text = CelTekst<br />
Txtnote.Select(1, 0)<br />
Txtnote.Enabled = True <br />
mnuCloseItem.Enabled = True Catch <br />
MsgBox("Error with opening the file.")<br />
Finally <br />
FileClose(1)<br />
End Try <br />
End If <br />
End Sub 
Plese tell me what is wrong???

David Dlaka

AnswerRe: Text Problem Pin
pmarfleet23-Oct-07 6:15
pmarfleet23-Oct-07 6:15 
AnswerRe: Text Problem Pin
Scott Dorman23-Oct-07 7:21
professionalScott Dorman23-Oct-07 7:21 
Questionsending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:10
jkonduru23-Oct-07 5:10 
AnswerRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:19
mveDave Kreskowiak23-Oct-07 5:19 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:24
jkonduru23-Oct-07 5:24 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:32
mveDave Kreskowiak23-Oct-07 5:32 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:38
jkonduru23-Oct-07 5:38 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 5:43
mveDave Kreskowiak23-Oct-07 5:43 
GeneralRe: sending data to the printer USing VB6.0 Pin
jkonduru23-Oct-07 5:52
jkonduru23-Oct-07 5:52 
GeneralRe: sending data to the printer USing VB6.0 Pin
Dave Kreskowiak23-Oct-07 6:05
mveDave Kreskowiak23-Oct-07 6:05 
QuestionChange to design view ms access's form from code Pin
haggenx23-Oct-07 4:49
haggenx23-Oct-07 4:49 
AnswerRe: Change to design view ms access's form from code Pin
Dave Kreskowiak23-Oct-07 5:03
mveDave Kreskowiak23-Oct-07 5:03 
GeneralRe: Change to design view ms access's form from code Pin
haggenx24-Oct-07 4:53
haggenx24-Oct-07 4:53 
QuestionSoftware Licensing VB.NET Pin
Cory Kimble23-Oct-07 3:27
Cory Kimble23-Oct-07 3:27 
AnswerRe: Software Licensing VB.NET Pin
Dave Kreskowiak23-Oct-07 4:53
mveDave Kreskowiak23-Oct-07 4:53 
QuestionRemoting [modified] Pin
RG_SA23-Oct-07 3:14
RG_SA23-Oct-07 3:14 
AnswerRe: Remoting Pin
Dave Kreskowiak23-Oct-07 4:51
mveDave Kreskowiak23-Oct-07 4:51 

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.