|
What's with the two identical Select clauses?? You only need one.
|
|
|
|
|
Mental aberration. It was early this morning for me. Will edit it.
|
|
|
|
|
Mate,
thats fantastic and helped me achieve what i needed
|
|
|
|
|
|
Hi,
what I typically do is:
- use a class (say "Contact") rather than a struct, so what gets passed around is a reference, not a copy of the data; hence better performance;
- a Dictionary(of Ref, of Contact) so one can enumerate all values, or search fast by key
But then I'm not sure you need the Ref field, maybe the reference to the Contact instance is enough, so you never need to search, hence no need for a Dictionary, a simple List(of Contact) could suffice. You would need a Ref field to persist the data to a file or database (pointers/references would be meaningless there).
|
|
|
|
|
Hi there,
Here's what I am trying to do.
Open a TCP/IP Connection (This works fine)
Close connection (this works fine)
Upon trying to then re-open the connection with the same or New IP Address it fails.
My Connect code:
Dim Lostconnection As MsgBoxResult
Try
client.Connect(TextBox1.Text, 7655)
Button21.BackColor = Color.Green
Catch
Button22.BackColor = Color.Red
client.Close()
Lostconnection = MsgBox("Program Not Connected... Retry?", MsgBoxStyle.YesNo)
If Lostconnection = MsgBoxResult.No Then
Me.Close()
End If
End Try
Button22.BackColor = System.Windows.Forms.Button.DefaultBackColor
My Disconnect Code:
Dim client As New Net.Sockets.TcpClient()
client.Close()
Button22.BackColor = Color.Red
Button21.BackColor = System.Windows.Forms.Button.DefaultBackColor
|
|
|
|
|
First, if you do this:
Dim client As New Net.Sockets.TcpClient()
client.Close()
You aren't going to achieve much as you have just closed a client that was never opened. the client in your connect code is difference to the client in your disconnect code unless they are in the same function.
Something to keep in mind, you cannot do this:
Dim client as New Net.Sockets.TcpClient()
client.Connect("www.google.com", 50)
client.Close()
client.Connect("www.google.com", 50) ' This will cause an error.
Close disposes the TcpClient, so it can no longer be used. You will have to create a new TcpClient to reconnect.
If this isn't your problem, try providing more detail.
And now some more basic tips:
Make sure the code you give us is the code you are actually using.
Wrap your code in <pre> tags to make them easier to read.
Make sure you provide full details of your problem, including what exceptions you get.
This might help you get more answers.
|
|
|
|
|
Hi Tony,
First off thanks for replying.
Yep, your first point was me just really copying and pasting stuff everywhere. I have removed it! Sorry for posting that.
You said: "Wrap your code in pre tags to make them easier to read"
how do I do that???
And your explination actually helped me. I don't actually want to close the connection do I!! Just catch the error, then as my message box states try again! - and when i do try again the connection is open so i can type the correct IP Address and off i go! - Cheers!
modified on Thursday, March 25, 2010 8:52 AM
|
|
|
|
|
The easiest way to achieve that is to press the code block item on the toolbar above the edit box, which gives you this:
<pre></pre>
Make sure you have 'Use HTML in this post' enabled, otherwise the < and > will be escaped.
(You may wish to edit your last post and unselect that option to remove the silly formatting that has happened )
|
|
|
|
|
Hi All,
I have developed a windows application,have a listview in one form...
Given below is the code to bind the listview :-
Dim sqlCmd As SqlCommand = New SqlCommand("Select Query")
Dim myData As SqlDataReader
Dim lvhHelper As ListViewData = New ListViewData()
Try
If _con.State = ConnectionState.Open Then
_con.Close()
End If
_con.Open()
sqlCmd.Connection = _con
myData = sqlCmd.ExecuteReader
lvhHelper.FillListView(LstItems, myData)
_con.Close()
And below is the FillListView Class file
Dim lvwColumn As ColumnHeader
Dim itmListItem As ListViewItem
Dim strTest As String
Dim shtCntr As Short
MyListView.Clear()
For shtCntr = 0 To myData.FieldCount() - 1
lvwColumn = New ColumnHeader()
lvwColumn.Text = myData.GetName(shtCntr)
lvwColumn.Width = "100"
MyListView.Columns.Add(lvwColumn)
Next
'lvwColumn = Nothing
Do While myData.Read
itmListItem = New ListViewItem()
strTest = IIf(myData.IsDBNull(0), "", myData.GetValue(0).ToString)
itmListItem.Text = strTest
For shtCntr = 1 To myData.FieldCount() - 1
If myData.IsDBNull(shtCntr) Then
itmListItem.SubItems.Add("")
Else
itmListItem.SubItems.Add(myData.GetValue(shtCntr).ToString)
End If
Next shtCntr
MyListView.Items.Add(itmListItem)
Loop
by using this codes listview is getting binded very slowly and will be blank hile loading...
is there anything wrong i did in this code?..
any otherway to bind the listview using datareader?..
Thanks in Advance..
|
|
|
|
|
Hi mates,
How would you make a datagridview in multiline column with checkbox and its name. In access its very easy you just put the checkbox with in details but in vb.net. How will i do that? To make it clear. click here[^]>
Another thing, in access when i enter a data in details it will automatically save to my worktable every column. Can i do that in vb.net?
As i know, in vb.net. you will loop the entire grid then save to worktable.
Thanks
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
このフォーラムはしゃぶられます。
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
From Google translate:
This forum will suck.
Wow. You didn't even wait 24 hours and you're already bitching that noone helps you. Did you stop to think that the people who saw your post didn't know the answer, so they post a reply? Order that regulars around here weren't available to even see your question?
We answer questions when our time allows, not when you demand an answer.
|
|
|
|
|
sorry for being stupid sometimes. apologize.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Hey guys, I've been having a hard time trying to figure out why I keep getting this error.
Here is the code:
Private Sub SendEmail(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Email.To.Add(Settings.txtTo.Text)
Email.From = New MailAddress(Settings.txtFrom.Text)
Email.Body = "Email Body"
Email.Subject = "Email Subject"
SMTPServer.Host = Settings.txtSMTPServer.Text
SMTPServer.Credentials = Authentication
SMTPServer.Send(Email)
End Sub
The error I get is: The parameter 'addresses' cannot be an empty string. Parameter name: addresses
And it's pointing to the Email.To.Add() section.
I thought the code would be pretty simple since I have text boxes in another form and I have linked to them before.
Thanks in advance for the help,
|
|
|
|
|
Sounds like the "txtTo" box is empty. Set a breakpoint on that line and see what Settings.txtTo.Text is set to.
|
|
|
|
|
I thought the same thing but the txtTo box is not empty.
How can I set a break point? I'm new to this whole scene so a little guidance would be greatly appreciated.
|
|
|
|
|
Put your cursor on that line, right-click, Breakpoint, Insert Breakpoint... You probably have a hotkey set to it... I believe F9 is the default. Then, when you run, it'll stop there so you can see what's going on.
|
|
|
|
|
When I run the program with the break point in it just highlights that line of code in yellow.
It doesn't show me what the value of that field is though.
|
|
|
|
|
when the row is yellow
Select whatever you want to see the value of then right click on your selection, click on quick watch and it will show you the value.
F9 = set breakpoint
F10 = step over 1 line
F11 = step into the line (for example when your calling a method on that line you will go to the first line of that method)
F5 = resume normal run
|
|
|
|
|
Ok, so I set the breakpoint for the txtTo line and when I right click it and hit QuickWatch it shows this.
txtTo-Name txtTo is not declared.
But in the Settings form where txtTo is at, I don't see any errors.
Thanks,
|
|
|
|
|
Is txtTo declared as Public or Private?
|
|
|
|
|
In the Properties section of the txtTo text box the Modifiers is set to Public.
I'm sorry if this isn't the answer you're looking for. I'm still learning, slowly.
|
|
|
|
|
Ok, let's see... When you break on that line, does Settings have a value? When you mouseover it when stopped there, does it show that it's set to a form?
|
|
|
|
|
When I break at that point and mouse over it, nothing happens.
When I mouse over "Email.From" it outlines it and says, "Email.From Nothing".
So does this just mean that it's not pointing to the settings (or now since I changed it to Prefs) form to find those particular text boxes?
|
|
|
|