|
No I am not going to click a suspicious link.
See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Hi, dear all,
I create a database using Access database.
There are some fields with data type Yes/No, I want to know to tell the difference of Null and False.
Right now even if I never set value for these field, they return false to me. I wants to clarify the difference.
I use the following code, but doesn't work, suppose I have a field called Marriage which is type Yes/No.
if user never fill in value for it, it should return Null, otherwise, return true or false
Dim obj as Object
obj = ResultSet.Tables(0).Rows(0).Item("Marriage")
If IsDBNull(obj) Then
return Nothing
ElseIf obj.ToString() = "True" Then
return True
Else
return False
End If
it always reutrn "False" to me.
Thanks!
|
|
|
|
|
I hope you were smart enough and googled your question. an adequate suggestion is readily available.
|
|
|
|
|
I search from google first, but didn't find any answer.
|
|
|
|
|
for decimal data type, everything is ok, only for Yes/No data type, if you didn't set value for it, it return False to you.
|
|
|
|
|
That is correct; if you don't like it, use something else.
|
|
|
|
|
In my program there is a function that loops through a list of files, opens each file, reads the contents, and then needs to output an excel file that contains the data plus additional notes that is determines from the data. The loop is something like this (overly simplified though)
Private Function ProcessFiles()
Dim FilesToProcess as List(Of String)
PopulateList(FilesToProcess)
For Each item As String in FilesToProcess
Dim fs As New FileStream(item)
Dim Data As String = fs.ReadToEnd
...
...
...
Next
End Function
In my program this is probably the function that takes the longest to complete and I feel that it might benefit from parallelization and would like to run some benchmarks. However I'm having trouble understanding how to implement the parallelization.
From what I've gathered so far I might be able to do something like this:
Private Function ProcessFiles()
Dim FilesToProcess as List(Of String)
PopulateList(FilesToProcess)
Parallel.ForEach(FilesToProcess ???)
Dim fs As New FileStream(item)
Dim Data As String = fs.ReadToEnd
...
...
...
Next
End Function
Not sure how to write the rest of the Parallel.ForEach . Any help would be greatly appreciated. Thanks in advance.
|
|
|
|
|
You can do this, but since you're using Excel in this loop, you may have just stopped this from working. You'll have to test to see if you can do this work in Excel from multiple threads at the same time. I don't think it'll work, but that's what testing is for...
|
|
|
|
|
I am creating Excel files, but I'm not using Interop. I have a third-party library that will let me create Excel files without Excel being installed on the workstation so this shouldn't be a problem.
|
|
|
|
|
if the individual jobs are not related, i.e. have no common resources (files, variables), then it should be really simple. You may want to read an article on Parallel class, such as this one[^] (examples are in C# though).
|
|
|
|
|
That is a great article. Don't know why through all my google searches it never came up. Much appreciated!
|
|
|
|
|
For Microsoft's related stuff, I always do a search directly on MSDN ; it seems that MSDN site's indexing by search bots is not very effective.
|
|
|
|
|
Dear all,
In my program using vb.net, it involves a lots of data (about 300), when generate report, we don't need to list all, so user need to choose from these data for output to report.
These 300 data is divided into 30 table, I am look for a better way to organize these data.
At first I am thinking create an excel file that list all these data, one in a row, and next to the data create a checkbox, protect all except the checkbox, so when user click "Select Output List", I will launch the excel, let user select data, save and close it, then from my program I will read the selection from excel file, but the clients don't like it. They don't want extra file. they want everything is inside the VB form.
I am new to VB.net, is there better way let me handle this issue?
Thanks!
|
|
|
|
|
why would you need an external program to do part of the overall job? can't you just show the data and the checkboxes on a Form (maybe using a DataGridView, a ListBox, or whatever Control you like), let the user select the data items, and proceed?
|
|
|
|
|
Luc,
Thank you for your quick reply.
I have 30 tables, If I use DataGridView to display them, can I merge some rows to make it looks like that the data is grouped by talbe? and also did you mean put all the 300 data in a DataGridView with a scrollbar? I also think about this, but I thought it's too crowded.
Can you give me more explaination? Thanks!
|
|
|
|
|
Does the data have logical groupings like Contact Info, Employment History, Certifications, etc ?
You could then use the Tabbed interface to create tabs on your form which would display the logically grouped items.
|
|
|
|
|
Yes, they are grouped by functionality. But there are 30 tables, if use tab, they should occupy at least 3 rows, it looks not good, right?
|
|
|
|
|
I cannot decide what it is you want, you should, or your customer.
Does the user need to see the content of a table in order to decide he wants to include it in the report? or is it just choosing tables from their table names? etc.
|
|
|
|
|
User will choose columns from these tables. so we need to list all columns in each table.
|
|
|
|
|
Hi,everyone! I want to insert an image into an Excel sheet,I know I could insert an file on disk into Excel sheet using these codes:
xlWorkSheet.Shapes.AddPicture("C:\xl_pic.JPG", _
Microsoft.Office.Core.MsoTriState.msoFalse, _
Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 45)
But I don't know how can I insert an image of Project Resources.resx File ,could anyone give me some suggestion or help ? Thanks a lot !
|
|
|
|
|
You can't import a resx file as an image. It's not in any image format and certainly not in a format that Excel understands.
You have to extract the image yourself and use the method you used before or a variant of it.
|
|
|
|
|
I've got it! Thank you, Dave!
|
|
|
|
|
Hi,
How do you select multi items in a listbox?
I have a listbox with say the following values
A, B, C, D, E, F
I want to select and then display the items I selected e.g. C, E, F
It has been a while since I done VB development and I am a wee bit rusty. Due to staff cutbacks.
Thanks in advance.
|
|
|
|
|
directred wrote: How do you select multi items in a listbox?
There's an excellent example on MSDN[^]
I are Troll
|
|
|
|
|
I have the multi selection on.
What I want to display is the actual items selected to be used in another procedure e.g. if b then etc
Almost like assigning the selected items to a variable.
Hope this makes sense???
|
|
|
|