Jump to content
Xtreme .Net Talk

Seb

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by Seb

  1. Can't access the Server I was wondering if u could look at the attached file to see if u can tell why I can't access the DB I have setup on the SQL Server. When I try to upload a file it says it 'can't access the server' even though it is running and I've setup the connection objects on each form that I think needs them. Many Thanks in advance.
  2. If ur designing an application in VB.NET with multiple forms and several of the forms need to connect to a SQL Server, does each form need to have its own SQL connection object on the design of the form? My reason for asking is that I keep getting an error message saying 'No SQL server was found' even though each form does have its own connection object. Thanks
  3. When u say 'absolute or relative path to the file', do u mean the path of the file it came from or path in the database it's being put into?
  4. No it just contains the filename.
  5. I'm trying to get a button to upload an image to a database via a SQL connection. But I get the following: "An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll Additional information: Empty path name is not legal." And the line in bold in this code is highlighted as the problem: Private Sub Upload_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Upload_Button.Click Dim SQLreturn As Integer Dim fsimage As System.IO.FileStream = New System.IO.FileStream(File_TextBox.Text, System.IO.FileMode.Open, System.IO.FileAccess.Read)Dim Picture(fsimage.Length) As Byte fsimage.Read(Picture, 0, fsimage.Length) Try SqlConnection1.Open() SqlCommand1.Parameters("@pictureTitle").Value = File_TextBox.Text SqlCommand1.Parameters("@pictureDescription").Value = DescriptionBox.Text SqlCommand1.Parameters("@pictureOwner").Value = System.Environment.UserName SqlCommand1.Parameters("@pictureData").Value = Picture SQLreturn = SqlCommand1.ExecuteNonQuery() 'command Catch ex As Exception MessageBox.Show(ex.Message) Finally SqlConnection1.Close() End Try If SQLreturn <> 1 Then MessageBox.Show("Could not execute the INSERT query") 'results Else MessageBox.Show("INSERT completed successfully") End If File_TextBox.Clear() End Sub Any suggestions welcomed. N.B. Also posted in Syntax forums by mistake, did not know how 2 delete from there.
  6. How do I loop through the 'selecteditems' collection?
  7. HELP NEEDED!! Anyone else have any ideas?
  8. I've tried that but it only deletes one at a time in either list box.
  9. I'm trying to make a button delete more than one item at the same time when they r all highlighted in a list box. Here's what I have so far: Private Sub DelButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DelButton.Click If LeftListBox.SelectedItems.Count <> 0 Then LeftListBox.Items.Remove(LeftListBox.SelectedItem) LeftTextBox.Focus() EnableDisableButtons() End If If RightListBox.SelectedItems.Count <> 0 Then RightListBox.Items.Remove(RightListBox.SelectedItem) LeftTextBox.Focus() EnableDisableButtons2() End If End Sub Cheers
  10. I see what I've done wrong now, I didn't have 'MessageBoxButtons.OKCancel' on the 'result=' line (I'd copied and pasted my line from some other code :o). I need to add another 5 'if' statements for 5 more buttons that can be clicked, so would I just add these names at the end of the 'result= ' line (i.e. 'MessageBoxButtons.OKCancel') ?? BTW how do u get the code to appear in a white box when u put it in a post. Cheers
  11. I tried putting text instead but it still doesn't like it even though ShowPanels is set to false. What do u mean by "displaying panels"? I haven't done anything with panels so far.
  12. Hi all, I'm trying to write code to re-produce the program I have attached. I'm having problems capturing the result of a button that is clicked when the message box is displayed after pressing the 'SHOW' button. The result needs to be shown at the bottom of the form. I've tried using a 'StatusBar' but it doesn't like 'Show' being put after it. Here's what I have so far: Private Sub ShowButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowButton.Click Dim result As DialogResult result = MessageBox.Show(MessageTextBox.Text, TitleTextBox.Text, buttons, icon) If result = DialogResult.OK Then StatusBar1.Show("OK") Else StatusBar1.Show("Cancel") End If End Sub Thanks in advance for any replies. [edit]The attachement has been removed. Please do not post binary files, but source files instead.[/edit]
×
×
  • Create New...