|
I think thi will do it :-
Dim a As New ArrayList()
Dim obj As Bookinfo = New BookInfo()
Return DirectCast(a.ToArray(obj.[GetType]()), BookInfo())
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
|
Unless you are stuck with framework 1, don't use ArrayList at all.
Use a generic list. As it's strongly typed you don't need any casting:
List<Bookinfo> a = new List<Bookinfo>();<br />
Bookinfo b = new Bookinfo();<br />
a.Add(b);<br />
return a.ToArray();
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all URGENT!!!
I posted this a long time ago and did not get any answers. can someone please help!!!
I have a vb.net datagridview. One col has a combobox, I want to populate another cell from within the same row as the ComboBox is based on the ComboBox selection.
Eg. ComboBox.Selectedtext="Yes" then DGV.DateGiven = date.today
Can someone please help me how to do this.
modified on Tuesday, November 25, 2008 7:59 PM
|
|
|
|
|
|
Dim dtDate(table.Rows.Count) as DateTime
Dim iValue(table.Rows.Count) as Integer
For row as Integer = 0 To table.Rows.Count
dtDate(row) = table.Rows(row).Item("DateColumn")
iValue(row) = table.Rows(row).Item("ValueColumn")
Next
Basically you keep recreating your arrays within the For..Next code block.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
This is a great suggestion, and similar to what I was doing.
The down side is that this array needs to be used by a different procedure and once I have gone out of scope in the dataset procedure the Arrays are empty when I get to the procedure they are to be used in.
THX
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Dim objStreamWriter2 As StreamWriter
Dim DTString As String
DTString = "C:\ETCLINK\" + Convert.ToString(Date.Now)
'Pass the file path and the file name to the StreamWriter constructor.
objStreamWriter2 = New StreamWriter(DTString)
I take a runtime error when the code is run. What is the problem? Thank you?
(objStreamWriter2 = New StreamWriter("C:\ETCLINK\09042008121212.txt") no problem here
|
|
|
|
|
Hmm.
Check out "DTString". When run it could be set to:
C:\ETCLINK\2001-01-01 11:11
This isnt a valid filename... The colon symbol ( : ) is a bad char.
|
|
|
|
|
I would concur with the other reply, although if you actually gave us the error message, we could provide a better answer.
If the problem is the resulting string from Date.Now, use the Format command to get the resulting string into the desired format.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi,
i've a little problem.
i must read from db one record, some field are null value and i cannot write it in my form.
I have thought about using the function iif, but I don't succeed in having the hoped result.
this is my code
with myDatarow
Textbox.Text = IIF(.IsSCALANULL, "", .SCALA)
end with
this is the error message:
the value of the column 'SCALA' in the table 'IMMOBILI' is DBNULL
thanks...
|
|
|
|
|
Smells like Italian Pizza.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
You've been a member for over a year. Have you never noticed the entire site is in ENGLISH?
Blog link to be reinstated at a later date.
|
|
|
|
|
My Paranoid Hubby wrote: the entire site is in ENGLISH
Sometimes one wonders...
Despite everything, the person most likely to be fooling you next is yourself.
modified on Monday, September 8, 2008 9:21 PM
|
|
|
|
|
The best solution ofcourse is to adapt your query (SELECT ISNULL(YourTable.YourField, 0) etc). If you can not adapt the query, another solution is to use IsDbNull(Datarow.Item("YourField"))
If IsDbNull(Datarow.Item("YourField")) Then
Textbox.Text = ""
Else
Textbox.Text = Datarow.Item("YourField")
End If
Hope it helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Your solution just did the job. Thanks.
|
|
|
|
|
Please put your thank yous with the relivent postings, thoughout if you are thanking Dave Kreskowiak I would also like to take this opportunity to thank him for the help he has given me in the past , he truly is a Guru.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi Eslam Afifi,
Your solution worked for me. thanks a lot
|
|
|
|
|
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I’m glad to hear that, you’re welcome
I’d like to point out that you should always reply to the original post instead of creating a new thread for the following reasons:
1- The new thread will take space in the message board and people would think it’s a question or something important.
2- If you create a new thread instead of replying, the original post’s author will not get notified by email that you posted something. I would have missed your reply if I had not checked the forum.
3- Even if the original post’s author notices your post, he/she may get confused what this post is for.
Eslam Afifi
|
|
|
|
|
Hi Friends
I am doing a simple project in that project am implementing flast file in vb form so that i need to store swf file to database and when i need retrive from database is it possible.
Thanking You
K. Rajesh Kumar
i am a fresher in software development i have so many doubts in .net so i need to ca
|
|
|
|
|
Save it into a blob or binary field in a table
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi
How to create application shortcut on Desktop for WinCE.........
Hitesh sojitra
|
|
|
|
|
Your question may be best asked in the Mobile Development forum.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks Steve Jowett
But still i don't get answer !!!
Hitesh sojitra
|
|
|
|