|
You are forgetting something: MS is "customer focussed". As in, MS likes to "foc" it's customers in the "uss" as much as it can...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The least they could do is take me out to dinner and a movie first.
Software Zen: delete this;
|
|
|
|
|
I'd rather not have them "foc" me in the "uss" and they can keep their dinner.
Ego non sum semper iustus tamen Ego sum nunquam nefas!
|
|
|
|
|
I think, there is no need for comment
private static void DoSplash()
{
SplashScreen sp = new SplashScreen();
sp.ShowDialog();
while (true)
{
Thread.Sleep(200);
}
}
|
|
|
|
|
|
|
That will definitely show a splash screen and make sure it stays around long enough for people to see it.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Ohhh... but that we don't know. We can't see what the other threads, if any, are doing with windows popping up...
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
I hope they implemented a "Please wait" message box when the user is forced to interact with the screen and close it
"You get that on the big jobs."
|
|
|
|
|
Intuitive design, isn't it? You have to close the splash screen manually, and afterwards nothing happens, though the process still "lives" in TaskManager. Wonderful!
By the way, haven't you found further gems in the SplashScreen class, e.g. showing the main window of the application?
|
|
|
|
|
SplashScreen class does not contain any user code, only Visual Studio generated stuff (i.e. only constructor with InitializeComponent ). This splash screen is launched in some sort of background thread and is terminated later by calling Thread.Abort . Surely it doesn't quite work. Splash screen hangs in front of main window until you move a mouse. I'm just too ignorant to understand deep logic which is embedded inside all that .
|
|
|
|
|
There's really not much logic in this one. Just a simple trap for next developer. The idea is, when the next developer spot the use of Thread.Abort and replace it with a Timer and Close() , the process will be caught in while loop.
[edit]Why would someone downvote that? Have a 5 to counter it.
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
modified 21-Nov-11 5:49am.
|
|
|
|
|
So not only does it display a splash screen in a very bad way it also creates and displays a UI control on a non-UI thread. Classic.
|
|
|
|
|
Better one ...
private static void DoSplash()
{
Interaction.Shell(Application.StartupPath + "\\splashscreen.exe", AppWinStyle.MaximizedFocus, true, -1)
}
.. and God help us all
|
|
|
|
|
AAAAAAAAARGH!
My colleague just told me that he has set up a document with a table of 20 columns to get a layout with 5 columns working. He claims it's "more flexible"
regards Torsten
I never finish anyth...
|
|
|
|
|
Yeah, thats an "ARGH!"
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
In an excel sub I have to copy and paste a large chunk of data from one workbook to another.
On paste I need to close the workbook I copied from, and before I can it shows the message about a large amount of data on the clipboard.
My work around?
Selection.Copy
Windows("Testbed.xlsm").Activate
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Selection.Copy
ActiveSheet.Paste
Windows("test.xlsm").Activate
ActiveWindow.Close
Those two lines of copy/paste in the middle save the day, but really ought to be consigned to the dustbin of depression.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Can you not use Application.DisplayAlerts = False before your copy and then Application.DisplayAlerts = True once your paste has completed?
|
|
|
|
|
FacePalm!
I knew there had to be a better way.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Also try Application.CutCopyMode = False
|
|
|
|
|
Public Function CHeckDataPrjVyd(ByVal data As String) As Boolean
Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim cmd As System.Data.SqlServerCe.SqlCeCommand
Dim dtr As System.Data.SqlServerCe.SqlCeDataReader
Dim i As Integer = 0
cn = New System.Data.SqlServerCe.SqlCeConnection("Data Source=" + values.DatabaseFile)
cn.Open()
cmd = New System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM data where oznacenie like '" + data + "'", cn)
dtr = cmd.ExecuteReader()
While dtr.Read
i = i + 1
If i = 1 Then
CHeckDataPrjVyd = True
Exit While
End If
CHeckDataPrjVyd = False
End While
cn.Close()
End Function
After cleaning that monstrosity:
Public Function IsDataPresent(ByVal data As String) As Boolean
Using connection As New SqlCeConnection(My.Settings.ConnectionString)
connection.Open()
Dim commandText = String.Format("SELECT * FROM data WHERE oznacenie LIKE '{0}'", data)
Using command As New SqlCeCommand(commandText, connection)
Using reader = command.ExecuteReader()
Return reader.HasRows
End Using
End Using
End Using
End Function
modified 9-Nov-11 9:38am.
|
|
|
|
|
I'm sure the original coder was being paid by the letter
Ondřej Linhart wrote: While dtr.Read
i = i + 1
If i = 1 Then
CHeckDataPrjVyd = True
Exit While
End If
Not only that but his function always returns true. Epic fail!
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
No it doesn't, if dtr.Read returns false first time out (i.e. there are no rows) it will return false. It works, at least from a quick read, just in a stupid fashion.
|
|
|
|
|
Ondřej Linhart wrote: Dim commandText = String.Format("SELECT * FROM data WHERE oznacenie LIKE '{0}'", data)
Little Bobby Tables[^] is going to love that one.
You should never build a SQL string, use command parameters[^] to keep it safe.
Also, I would advice against SELECT * ... , it is a lazy approach. If you only want to know if the row exists use SELECT oznacenie FROM data WHERE oznacenie LIKE @OZ
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
And, please, tell me what exactly an oznacenie is.
Guessing by Google images, it may be a sign
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|