|
Oke i know this sounds a bit basic but have you checked for spaces? strings are quite picky with those. "0 " is not the same as "0" for them. tough its likely a human will read over that last space.
you could add a replace to the .text to get rid of this problem.
If Button1.Text.Replace(" ","") = "1" then
Button1.Text = "0"
Elseif Button1.Text.Replace(" ","") = "0" then
Button1.Text = "1"
End if
EDIT: oke reading some more and i hear some rumors that your using several threads. if this thing is executed in a thread you might want to enforce the update to your gui.
Private Sub updateUI()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf updateUI))
Else
Me.Update()
End If
End Sub
if your using that button thing in a sub/background thread then add the above sub and try calling it after the button event is done. be aware that this isn't good code and will enforce a full refresh of your screen, its a nice way to test tough.
|
|
|
|
|
Thanks Nick. But the issue has already been resolved
|
|
|
|
|
Hi,
Currently when I add a new control to the FlowLayoutPanel1, it gets added to the bottom of all the previous controls that were added in FlowLayoutPanel1. Is there a way that I can add the new controls to the top of FlowLayoutPanel1?
I have added a small diagram of what I want:
http://foto.pk/images/havewant.png[^]
Please note that the flowdirection property isn't giving me the effect that I need. Because new items (controls) are added while the app is running.
Source code of the application added:
http://www.mediafire.com/?1uo8zd3ybgdmiwp[^]
*Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it.
Can you please add that feature that I want in the source?
modified 22-Jun-12 9:23am.
|
|
|
|
|
Hey,
Have you try'd settings the index of the new control?
FlowLayoutPanel1.Controls.SetChildIndex(Button1, 0)
Here button1 is my control as control and 0 (int) is the new index of the control in the flowlayoutpanel.
|
|
|
|
|
Not quiet sure how that is done as I am new to controls and flowlayoutpanel.
Here is the code that adds the tweets(items) into the control that I have made:
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))
End If
End Sub
Private Sub NewTweet(ByVal tweet As TwitterStatus)
On Error Resume Next
AddTestTweet(tweet)
End Sub
And here is the control:
Public Class TweetTimelineControl
Public Sub New(ByVal status As TwitterStatus)
Me.InitializeComponent()
Me.userPictureBox.LoadAsync(status.User.ProfileImageLocation)
Me.UserNameLabel.Text = status.User.ScreenName
Me.Label2.Text = status.CreatedDate.ToShortDateString()
Me.DateLabel.Text = status.CreatedDate.ToShortTimeString()
Me.TextLabel.Text = status.Text
Me.Label1.Text = "Number Of Retweets: " & status.RetweetCountString
End Sub
End Class
Can you please tell me how to do this on the code given above?
|
|
|
|
|
Hey
I gotte say i dont know your program so this is a bit of guessing. But from what you send i would suggest you place the code into your AddTestTweet sub.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Me.FlowLayoutPanel1.Controls.Add(New TweetTimelineControl(tweet))
End If
End Sub
|
|
|
|
|
Nope. Still don't get it.
Here I have uploaded the entire source code:
http://www.mediafire.com/?1uo8zd3ybgdmiwp[^]
*Note: The above download has all the twitter keys for my account so you don't have to make a new account or anything. Please don't misuse it.
Can you please add that feature that I want in the source?
modified 22-Jun-12 9:22am.
|
|
|
|
|
I got the file, so you can remove the link if you want. Cant promise i can get to it ASAP, but i will see if i can paste in the code you need.
EDIT:
Oke got a quick look at it during work. the twitter is blocked here so i cant actually test it. but i think if you replace your AddTestTweet sub with this one it will work.
Private Sub AddTestTweet(ByVal tweet As TwitterStatus)
If (Me.FlowLayoutPanel1.InvokeRequired) Then
Me.FlowLayoutPanel1.Invoke(New AddTestTweetDelegate(AddressOf AddTestTweet), tweet)
Else
Console.WriteLine(String.Format("New tweet: @{0}: {1}", tweet.User.ScreenName, tweet.Text))
Dim storedtweet As New TweetTimelineControl(tweet)
Me.FlowLayoutPanel1.Controls.Add(storedtweet)
Me.FlowLayoutPanel1.Controls.SetChildIndex(storedtweet, 0)
End If
End Sub
Like i said its untested so don't shoot me if it adds to the bottom, try playing with the 0 if this happends(make it FlowLayoutPanel1.Controls.Count for example).
modified 22-Jun-12 9:20am.
|
|
|
|
|
Alright. Thanks.
modified 22-Jun-12 9:22am.
|
|
|
|
|
Edited my last message with a possible solution.
|
|
|
|
|
That worked beautifully!
Thanks m8!
|
|
|
|
|
no problem! glad to be of help (tough as it seems a formality here: remember to vote )
|
|
|
|
|
Already done
|
|
|
|
|
Is it possible to insert rows in to a MS Access table with a Auto number field using a CommandBuilder. I tried that but it's getting following error.
Syntax error in Insert in to statement.
I did same thing to a table which doesn't have a auto number field. It worked. I think the problem is that auto number field. What's the solution for this problem.
|
|
|
|
|
I believe the problem may be that you are trying to pass a value for the auto number field. That would cause the insert to fail. In your Insert statement, list the fields you want to include, but don't list the Autonumber field, then in your value clause list only the values which need to be inserted.
remeber to vote
|
|
|
|
|
I didn't use any Insert statement. Just used CommandBuilder class to generate SQL statements
|
|
|
|
|
|
Hello,
I'm struggeling with a bit of a problem. I got a program that prints production forms using excel. the problem is users are printing batches of 300 or more of these. The Xerox WC 3745 printer driver cant keep up with this and crashes.
I'm looking for a way to merge these printer tasks. i already try'd merging the work sheets into one workbook. this didnt work to well...excel doenst like to handle more then 250 worksheets it seems. also merging all data from the worksheets into one massive worksheet doesn't work (the layout cell count ect. are not the same)
anyone able to point me in a possible solution? perhaps i could catch the printer jobs and resend them as one big job? or is there a way that makes excel to do it that i just didnt find yet?
following code is looped to start the print jobs in the current version:
If rbexact.Checked Then
workbook.PrintOutEx(1, 3, 1, False, verbinding.printer(), False, Collate:=True)
Else
workbook.PrintOutEx(1, 3, 1, False, DefaultPrinterName(), False, Collate:=True)
End If
|
|
|
|
|
This is going to sound like overkill, but ...
1) Create a directory on the machine which will hold a list of file names which need to be printed.
2) Create a windows service which monitors the directory by using a FileSystemWatcher, when it sees a file added to that directory it looks to the printer to see if there is a job currently printing, if so, make the job sleep for a 1 minute (or whatever). If the printer is available, then send the job.
I created a Service with a FileWatcher to do all kinds of asynchronous processing and it works really well. I log messages to the Event Log for easy troubleshooting / status.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^]
Remember to vote.
|
|
|
|
|
Hello David,
thanks for the idea's. the program is already creating a "spool" folder on the C:\temp to store its files before printing them. so its already using the method you described. The problem with it is that still every file is a differed printer job
As a side note: i totally agree to you when we talk about overkill. this program was initially created to print like 10 forms a week. but some people found it on the network and are now "abusing" it. I have a executing function, in other words i just get a mail about these problems with a note stacked to it saying 'fix it'
|
|
|
|
|
How about seeing if there is an updated printer driver first?
AFAIK, there's no way to combine many print jobs into a single job without rewriting the entire job from scratch. Writing the code to do that is not what I would call a productive use of your time.
It's not the most efficient solution, but how about throttling the print jobs? Send about 10 jobs at a time, wait, send another 10, wait, rinse and repeat.
|
|
|
|
|
hello Dave,
the drivers are already at there most recent version. the problem is on the printer tough. the printer itself gets an error and that makes the drivers crash. so unfortunately that wont help to much.
I already considered making batches of jobs to send. but the crashing of the printer inst the only issue with the program (i just left less important once out to shorten the post). A other problem i had was that when other people printed documents they got lost in the pile of papers. and it already happened once that those papers got onto the work floor (witch caused the necessary panic)
|
|
|
|
|
Nick Otten wrote: the drivers are already at there most recent version. the problem is on the
printer tough. the printer itself gets an error and that makes the drivers
crash. so unfortunately that wont help to much.
If that's the case, no amount of code you write is going to fix this problem.
See if there's a firmware update for the printer. If not, you're pretty much screwed. You can queue up the jobs or print onat a time, but if the printer is going to puke, there's nothing you can do about it, well, except replace the printer with a different one.
Nick Otten wrote: I already considered making batches of jobs to send. but the crashing of the
printer inst the only issue with the program (i just left less important once
out to shorten the post). A other problem i had was that when other people
printed documents they got lost in the pile of papers. and it already happened
once that those papers got onto the work floor (witch caused the necessary
panic)
This sounds like a procedural problem with people, not your app. There's isnot anything that's going to some this one, except maybe getting a printer dedicated to printing this stuff.
|
|
|
|
|
The error on the printer is coused by the speed and ammount of print job is has to swallow. if i print a file with the same amount of pages its not really a problem. I already updated the firmware to the newest version and even contacted Xerox for help. but they said the machines are just not made to handle printer tasks at the speed i send them.
Anyhow i indeed think its a lost cause to save this little application. i think i'm going to make a "spool file" on a network drive where all excel templates are stored. then during night time i make one of the background threads pick it up and print them, so the forms are all done the next morning. this way i can set it to a much lower speed (like 1 file per 10 seconds and something).
So all that last me now is to thank you very much for your help!
|
|
|
|
|
Nick Otten wrote: The error on the printer is coused by the speed and ammount of print job is has
to swallow. if i print a file with the same amount of pages its not really a
problem. I already updated the firmware to the newest version and even contacted
Xerox for help. but they said the machines are just not made to handle printer
tasks at the speed i send them.
That's a load of horse sh*t. The speed of the jobs is dictated by the printer, not the application. The printer signals it's ready and idle to its driver on the print server (the client machine) and the spooler sends the next job.
The spooler is insulating the printer from the applications print jobs. You can send as many jobs as you want as fast as you want. They all get sent to the spooler, not the printer. The printer won't know anything about it at all.
This is definitely a problem for Xerox to fix, not you.
Wanna try it? Swap the printer out, install the drivers and try your app unmodified on a different printer.
|
|
|
|