Question InputBox error

slickskater29

New member
Joined
Oct 14, 2008
Messages
1
Programming Experience
1-3
I get an error on the InputBox that says:

"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.VisualBasic.CompilerServices.VBInputBox.resources" was correctly embedded or linked into assembly "Microsoft.VisualBasic" at compile time, or that all the satellite assemblies required are loadable and fully signed."

Here is my code:
VB.NET:
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
        Dim strName As String
        Dim strAddress As String
        Dim intAge As Integer
        Dim intCount As Integer

        Dim strFileName As String
        Dim fileFriends As System.IO.StreamWriter

        'Find & Open the File
        strFileName = InputBox("Enter file path/name", "File Name Needed")
        fileFriends = System.IO.File.CreateText(strFileName)

        'Get data & write to file
        For intCount = 1 To 3
            'get data
            MessageBox.Show("Get ready to enter data for friend #" & intCount.ToString())
            strName = InputBox("Enter name: ", "Friends Name")
            strAddress = InputBox("Enter address: ", "Friends Address")
            intAge = CInt(InputBox("enter age: ", "Friends Age"))

            'write to file
            fileFriends.WriteLine(strName)
            fileFriends.WriteLine(strAddress)
            fileFriends.WriteLine(intAge.ToString())

        Next

        'Close file
        fileFriends.Close()
    End Sub
End Class

Let me know if you want the whole code.

Thanks!
 
Last edited:
First off you shouldn't be using the InputBox. To get a filename add an OpenFileDialog object to your designer, then use that to get the filename.

I added an OpenFileDialog object and named it ofdGetFile. When I want to get the file name, call the ShowDialog method and this opens a file browser that users can select the file.

VB.NET:
  If ofdGetFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
            strFileName = ofdGetFile.FileName

        End If

The getting and saving of friend information would be better handled with an another form that is it's sole job. Made a new form and added 2 textboxes, a numericupdown to the designer, 3 labels, and 2 buttons. named respectively: txtName, txtAddress, nudAge, lblName, lblAddress, lblAge, btnSave, btnDone

VB.NET:
Public Class InputFriend
Dim FileName As String

Public Sub New(byval PassFileName As String)
FileName = PassFileName
End Sub

Private btnSave_Click(byal sender as object, byval e as system.eventargs) handles btnSave.Click

using sw as new system.io.streamwriter(filename)
sw.writeline(txtName.text)
sw.writeline(txtAddress.text)
sw.writeline(cint(nudAge.value))
end using

'reset the text boxes and nud for the next entry
txtName.text = ""
txtAddress.text = ""
nudAge.value = 0
End sub

Private btnDone_click(byval sender as object, byval e as system.eventargs) handles btnDone.Click
me.close()
end sub

End Class

Be advised that I didn't actually run any of this code, however i am pretty sure that it would work. You should be able to come up with the code to check to make sure that items are entered correctly or what not. :)
 
Back
Top