...but in real-life I've seen "obviously unnecessary" else-blocks quite often. Most times there was an error-handling routine, which put something like "unhandled case; please look at routine foo()" to your log-file. And in some cases it make sense - who guarantees you that a guy who extends this routine, thought on all possible occurances of "i"?
Sebastian Br
Posts
-
How to sequence a loop -
Vb.net & SQLiteYou could use a "SELECT COUNT(*) ..." as SQL and then add something like this to your code:
Integer.Parse(sqlCommand.ExecuteScalar().ToString)
Another method is to create a DataTable first (using your SQL statement above):Dim aDataTable As DataTable Dim aDbDataAdapter As DbDataAdapter sqlCommand.CommandText = sql aDbDataAdapter.SelectCommand = sqlCommand aDbDataAdapter.Fill(aDataTable) aDbDataAdapter.FillSchema(aDataTable, SchemaType.Source) aDataTable.TableName = tableName
and then evaluate the Row-Count:aDataTable.Rows.Count
-
VB 2008 DataGridViewTry the following: For iRow = 0 To dgvPreview.RowCount - 1 For iCols = 0 To dgvPreview.ColumnCount - 1 (Note the additional "- 1" at the end of the lines) Maybe it is also helpful for your further devolpments to use try-catch-blocks, to handle exceptions. Normally the Exception itself contains several useful information, which could help you to identify the error's position and circumstances.
-
How to watch StringBuilder strings while debugging?Thanks, works fine!
-
PrintDocumentMaybe you could inspire yourself using this resource: http://omgili.com/newsgroups/microsoft/public/de/german/entwickler/dotnet/vb/F926EA6F-B957-4842-BE93-C862FBC5E9B3microsoftcom.html[^]
-
Where do you go for Icons?Take a look at Axialis. They got some very nice icon sets for free (as far a I rember u can use it under a Creative Commons license). http://www.axialis.com/free/icons/[^]
-
SQL:what is wrong in following queryI would take a look on the SQL statement directly before executing.
-
ADO.NET / Update Column in memoryIt works fine, thanks.
-
ADO.NET / Update Column in memoryOkay, I'm new to the whole ADO.NET stuff, so don't punish me to hard if I ask a total bullshit question... First, here's a piece of code (assume, aDataSet is already initialized and the table "aTable" also exists):
Dim aRow As DataRow aDataSet.Tables("aTable").Columns.Add("isParent", System.Type.GetType("System.Boolean")) For Each aRow In Me.mDataSet.Tables("aTable").Rows aRow.Item("isParent") = True Next
What I wanna do: Add the new column "isParent" to "aTable" (okay, I managed this), and initialize it with a standard value (I do this in the for-next-loop). But I thought, there must be a more elegant way to do this, without picking every single cell in a loop. Anyone know a good solution? I don't need to write in a database, 'cause my aDataSet is build on the fly, without database representation.
-
convert string to int?Are you sure your variable has any value?
-
Icons to ApplicatonAxialis has several sets of icons which should fit for most tasks: http://www.axialis.com/free/icons/[^] The icons are licensed under the Creative Commons Attribution License.
-
VB.NET / Printing Webbrowser Controlokay, but how can I assign PrinterSettings to .NET's webbrowser control?
-
VB.NET / Printing Webbrowser ControlThanks for your reply, but the article won't help me. I need to specify the printer name via source code.
-
VB.NET / Printing Webbrowser ControlHello, I need some help related to printing from .NET's Webbrowser control. I already figured how to print and how to change header/footer, margins and so on ( Some Cool Tips for .NET[^] ). But how I can change the printer that is used for this printjob? I know I could use webbrowser's .ShowPrintDialog() or .ShowPageSetupDialog() methods, but my users shouldn't gambling with this dialogs... they only want printing, without any dialogs, so I must select the printer in my source code. I also know I could change the default printer for exactly the time my printjob is in the pipeline - but that's not fine art, isn't it? That seems to be the ultimate brutal solution, so I would prefer a more elegant solution for my problem. Any suggestions? Thanks for all answers, and I hope I made my problem understandable... - Sebastian
-
problem related to sorting of listview....Okay, you defined your sorting order, but you forgot to sort! Add the following: Me.lst1.Sort()
-
Datagridview Print in VBThere's already a good article about printing a DGV which helped me a lot: http://www.codeproject.com/KB/printing/datagridviewprinter.aspx[^] Note that there's an translatioon to VB in the comments at the end of the article.
-
Compare two Table -
Printing Datagridview...or this: http://www.codeproject.com/KB/printing/datagridviewprinter.aspx[^] Note that there's also a port to VB.NET in the messageboard at the end of the article.
-
Upgrading VB6 to VB.net printing problemI cannot help you exactly on your problem, but Microsoft has an excellent article on printing in .NET: http://msdn.microsoft.com/en-us/magazine/cc188767.aspx[^] It helped me a lot to learn about printing in VB.NET. Note that there's some source-code relating to the article which also deals with multi-page texts. Maybe it's worth to have look. There is also a lot neat stuff in it, like status texts in status bars, print preview and so on.
-
How to Change Cell Backcolor if Datagridview2.item.value = Datagridview1.item.value [modified]What exactly you need to know?