|
You beat me to it!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Yeh, but notice we both got voted 1.
Now was that because the suggestions weren't an acceptable answer for the OP, or did someone else think we were taking the pi$$.
Guess we will never know!
Do you want a 5 exchange?
|
|
|
|
|
I will 5 you all the way down, just to be sure!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Use My.Computer.Clipboard
This may help[^]
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Hi Dave,
These things doesn't workout for me . Bcoz i implemented my custom way to build the application .
Clipboard Serializable format but it's not working.
Regards,
For1206
|
|
|
|
|
Ah, sorry then, I cannot help further.
But do be careful and think before doing!!!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
for1206 wrote: So how can i serialize to clipboard
Don't! Remember the clipboard is a user controlled mechanism. If you serialize to the clipboard and the application then terminates you have lost control of the clipboard, and potentially all your objects. Serialization should be to permanent storage, e.g. disk files.
MVP 2010 - are they mad?
|
|
|
|
|
Like Richard said, you copy to/paste from the Clipboard, in whatever format suits your app (text, image, file list, ...); and you serialize to/from permanent storage in some format (binary, XML, ...) to make your object persistent. Those are two distinct mechanisms with different purposes.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi friends,
I want to develop a small Application.
In Brief a scanned Paper which is of four A4 Pages.
It contains image and at the bottom contains many fields.
SO that I have to develop a application.
The Image size is too large. SO, I would like to apply scrolling for ImageBox.
and How to make active of the next item..
Please let me know.
Thanks
|
|
|
|
|
|
yes, a Control-in-Control technique is the easy way out. PictureBox-in-Panel is fine.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
I am working on an application in which month and year is selected through combobox.
On selection on both, a checklistbox is filled with data for the selected month and year.
When I select the month and then year in application that is connecting to remote server, the system hangs. But the same when I do on a machine that connects to another remote server works fine.
What could be the possible reason for this?
I call a sub procedure on the selectedindexchange event of the combobox
Code in the sub proc is as below:
Private Sub FillClients()
Dim sqlComIns As SqlCommand
Dim iRec As Integer
Dim sSQL_Temp As String
If CboMonth.Text = "" Or cboYear.Text = "" Then Exit Sub
Call DisposeAllObjects()
sSQL_Temp = "DELETE FROM GlobCustNonZeros_Cust"
sSQL = "INSERT INTO GlobCustNonZeros_Cust(Global_Cust)SELECT DISTINCT GLOBALCUST FROM tbMain WHERE FeesAmt<>0" & _
" AND UpMonth='" & CboMonth.Text & "' and UpYear='" & cboYear.Text & "' AND GlobalCust NOT IN (SELECT Global_Cust from GlobCustZeros_Cust)"
LstClient.Items.Clear()
Try
objDB = New ClsConnection
sqlcon = New SqlConnection(objDB.conStr)
sqlcon.Open()
sqlComIns = New SqlCommand(sSQL_Temp, sqlcon)
sqlComIns.CommandTimeout = CMDTimeOutFirst
sqlComIns.CommandTimeout = CMDTimeOutSec
iRec = sqlComIns.ExecuteNonQuery
sqlComIns = Nothing
sqlComIns = New SqlCommand(sSQL, sqlcon)
sqlComIns.CommandTimeout = CMDTimeOutFirst
sqlComIns.CommandTimeout = CMDTimeOutSec
iRec = sqlComIns.ExecuteNonQuery
sSQL = "SELECT Global_Cust FROM GlobCustNonZeros_Cust ORDER BY Global_Cust"
sqlComm = New SqlCommand(sSQL, sqlcon)
sqlComm.CommandTimeout = CMDTimeOutFirst
sqlComm.CommandTimeout = CMDTimeOutSec
sqlRead = sqlComm.ExecuteReader
Do While sqlRead.Read
LstClient.Items.Add(sqlRead("GLOBAL_CUST"))
Loop
sqlRead.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Any help will be highly appreciated as its very urgent.
thanks in advance
Regards
Imran
|
|
|
|
|
GSS_imran wrote: Do While sqlRead.Read
LstClient.Items.Add(sqlRead("GLOBAL_CUST"))
Loop
Put a break point here to see if your code is getting into an infinite loop.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Have you tried stepping through the processes using the remote server that seems to hang? You need to identify which process is either getting stuck or whether you do go into an infinite loop somewhere. The
Do While sqlRead.Read
loop shouldn't go into an infinite loop.
Another thing that I would do is to create more Try /Catch segments. It would be more informational for you if you had separate messages for separate processes. Like:
objDB = New ClsConnection
sqlcon = New SqlConnection(objDB.conStr)
Try
sqlcon.Open()
Catch ex as Exception
MessageBox.Show("Open ConnectionString" & vbNewLine & ex.Message)
End Try
sqlComIns = New SqlCommand(sSQL_Temp, sqlcon)
sqlComIns.CommandTimeout = CMDTimeOutFirst
sqlComIns.CommandTimeout = CMDTimeOutSec
Try
iRec = sqlComIns.ExecuteNonQuery
Catch ex as Exception
MessageBox.Show("Execute " & sSQL_Temp & vbNewLine & ex.Message)
End Try
sqlComIns = Nothing
sqlComIns = New SqlCommand(sSQL, sqlcon)
sqlComIns.CommandTimeout = CMDTimeOutFirst
sqlComIns.CommandTimeout = CMDTimeOutSec
Try
iRec = sqlComIns.ExecuteNonQuery
Catch ex as Exception
MessageBox.Show("Execute " & sSQL & vbNewLine & ex.Message)
End Try
sSQL = "SELECT Global_Cust FROM GlobCustNonZeros_Cust ORDER BY Global_Cust"
sqlComm = New SqlCommand(sSQL, sqlcon)
sqlComm.CommandTimeout = CMDTimeOutFirst
sqlComm.CommandTimeout = CMDTimeOutSec
Try
sqlRead = sqlComm.ExecuteReader
Catch ex as Exception
MessageBox.Show("Execute " & sSQL & vbNewLine & ex.Message)
End Try
Do While sqlRead.Read
LstClient.Items.Add(sqlRead("GLOBAL_CUST"))
Loop
Try
sqlRead.Close()
Catch ex As Exception
MsgBox("Close ConnectionString" & vbNewLine & ex.Message)
End Try
A lot of your code within your Try /Catch doesn't need to be there. You're not getting the information you could be getting if you had an error.
|
|
|
|
|
My original code looked like this:
If strNumber <> vbNull And strProvider <> vbNull And strEmail <> vbNull Then
But that would throw an error @ strProvider saying that i was trying to convert a string to a double.
So I changed it to:
If strNumber <> vbNull & strProvider <> vbNull & strEmail <> vbNull Then
(replaced "And" with '&')
Now it throws an error @ strEmail saying that im trying to convert string strEmail to a Boolean.
Can someone please tell me what Im doing wrong?
|
|
|
|
|
What if You replace the vbNull with Nothing?
|
|
|
|
|
if you want to test if the string is empty use if strNumber.Equals(string.empty) , if you want to test the object is an actual object use if strNumber isNot Nothing
So to test the list you have above;
If (strNumber isnot nothing) and (strProvider isNot Nothing) and (strEmail isNot nothing) then
or if you are testing for empty string i.e "" then
if strnumber.equals(string.empty) and strProvider.equals(string.empty) and strEmail.equals(string.empty) then
|
|
|
|
|
If it's VB.NET you can also combine them in one:
String.IsNullOrEmpty(strNumber)
Possibly not relevant to the original question, but useful to know.
|
|
|
|
|
The problem here is that vbNull is not the same as Null. vbNull is an integer value. It is the code value which represents a variant type of null. So,
VarType(Null) = vbNull
If this is VB6 you check for a null variant value with:
IsNull(aValue)
If it is VB.NET, as mentioned elsewhere you should use
strNumber IsNot Nothing
or, if you are still using an older version of .NET you will have to turn it round and say
Not (strNumber Is Nothing)
since the IsNot keyword was introduced in .NET 2 (I think).
Also, the & operator does something completely different to the And keyword. You can't simply replace one with the other.
|
|
|
|
|
Sudden thought: if it's VB6 you may also need to read up on the difference between IsNull and IsEmpty.
|
|
|
|
|
I thought the new ruling on the VB board was assume .Net unless the OP tells you differently, that way [vb6 users] will be bomarded with all the .net goodness, and have to admit they are using VB6 and realise its maybe time to move on.
|
|
|
|
|
that would be good, if only it got displayed on top of this forum so all can see it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Luc Pattyn wrote: that would be good, if only it got displayed on top of this forum so all can see it.
I mentioned it previously that it was maybe time to splinter of the formum for VB6, and let it die gracefully in the background, and rename this one VB.Net
VB6 is the new Fight Club
First rule of VB6 - You don't talk about VB6!
|
|
|
|
|
the problem with splitting this forum (or any other) is it would leave a lot of old messages in the wrong half.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Granted, but the benefits of a split outweigh the inconvenience of having old messages either here or in the newly split VB6 forum. Since, I can only assume it is safe to say that the majority of old messages or threads revolve around .net, and a solid percentage of the posts of VB6 are a standard 'upgrade to .net, ms no longer supports vb6, or you can't do that in vb6' posts then it would be wiser to leave the content within the vb.net forum as it is more likely to be beneficial to other members here.
Splitting them isn't that bad an idea.
|
|
|
|