|
Thanx Luc..
I think this might be the problem.
I'll check my all codes once again. There's a high chance that I might have forgotten to close the recordsets or release resources while not working with them.
|
|
|
|
|
Hello all,
I am facing a problem while extact the Data from Excel in VB.Net
when I am having a Date Value and Double Value in Excel Spread Sheet.
When i am converting the Date Value Using Date.FromOADate(double args) Function, The Double Values in Excel are also converted to Date Format which is going Wrong. As Double Values in Excel Remain Double and Date Values must be converted to Date.FromOADate(...) as it is in OleDate Format which is again double.
I want to Convert Only the Date Field Values which are in Double format,
Not double values in Excel.
Please Suggest any Approach, It is Very Urgent.
Regards,
Uday.
|
|
|
|
|
Your question is not very clear at all.
Are you saying that you have two different date values (Ole and Double) in the same column of data and you want to be able to tell the difference between the two?
|
|
|
|
|
I will Explain You,
I have entered some double values in A3 Range of Excel.
Also some Date values in A3 Range of Excel.
While Retrieve this A3 Range Both the double value and Date values are showing as double.
So while converting the date value i used Date.FromOADate(double) it is OK for Date, But for the Range A3 there are also double values entered, This are also converting to Date value which must not happen for double values.
As Both Date value and Double Value in A3 Range are finally showing as double from excel,so i am not able to distingush for exact casting for Date values in A3 Range.
Please help me out.
Thanks & Regards,
Uday.
modified on Tuesday, November 17, 2009 12:15 PM
|
|
|
|
|
That explanation doesn't help much.
A3 is a single cell, or a Range consisting of one cell. Your explanation says that you have multiple values in A3 and that just isn't possible.
The only way to tell the difference between the two date values is to try to convert them to a date and see if the date comes back in a known range. If the date doesn't appear inside this range, try the other conversion. If it doesn't match either valid date range, you'll have to handle that value approriately.
|
|
|
|
|
janaswamy uday wrote: I want to Convert Only the Date Field Values which are in Double format,
Not double values in Excel.
If you are doing the converting then you need to apply the correct format depending on the source, whether it is a date or not.
|
|
|
|
|
dear All,
I understand but i will give a Article where the same problem is been raised.
Please see this Link There he has also same Problem :
Reading Excel Dates. Excel date gets converted to Double value in DotNet
------------------------------------------------------------------------
----> See this Link "http://social.msdn.microsoft.com/forums/en-US/vsto/thread/5b70f5e2-90c3-4824-99e4-8733be2e35ac"
I mean if we have Date Values and Double Values in a perticualr Range then how to find it is Date Value or Double Value ?
Regards,
Uday.
|
|
|
|
|
I already said, since the Date serial number is no different than a double, you have to either:
1) make sure that your dates do not end up intermingled with actual values or other date representations
2) try to convert the suspect date value into an actual date and test it for validity. If you know there cannot be any dates outside of a certain range, then you've got the wrong conversion if a date falls outside of that range. Try another conversion function and test again.
|
|
|
|
|
Dear Deave,
I think it is not correct solution. Please give me correct Solution for this. i mean if date and double lie in 1900 Year then what we can do.
Regards,
Uday
|
|
|
|
|
Rudheesh wrote: Please give me correct Solution for this.
How many times do you need this explained? Excel stores dates as double values and does not distinguish them from 'ordinary' doubles. It is the user's responsibility to know which cells are supposed to be dates; e.g. one column represents transaction date and the next column transaction cost.
|
|
|
|
|
Yeah, it IS the correct solution for your situation.
The only REAL solution is to normalize the data ahead of time and make damn sure you do not mix value types in the same data "column". If you're mixing normal Double values and Ole date serial numbers (also represented by a Double value,) in the same "column", you've got a horrible data model that just got you in trouble.
|
|
|
|
|
Strange question, but I'm sure someone's dealt with it.
When there are say 2 dimensions, and we want to loop within each of the 2, we write
for a = 0 to x
for b = 0 to x
do something...
next
next
And if there are 3 dimensions, we just add a c loop within the b loop, etc.
What if we don't know ahead of time how many dimensions there are? Can we write the looping structure to be dynamic based on a specified number of required loops?
Thanks
|
|
|
|
|
depending on circumstances recursion, reflection or a simple foreach may do it.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
That would be awful. Unless you just cannot avoid it, don't use it. What if there are 10 nested loops each going from 0 to 1000?
If there will be no code between the two loops, you can do something like this:
for(int i = 0; i<dimensions;i++){
Looper(loopFrom,loopTill);
}
Then in the Looper method:
private void Looper(loopFrom,loopTill){
for(int i=loopFrom;i<loopTill;i++){
}
}
Looks awful.
You can also generate dynamic code blocks and inject when required.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Thanks for the ideas. I figured out a way to do this with a collection.
Roughly, you make your own looping code:
Make a collection with the same number of rows as you have dimensions
Each row has a property indicating its number of iterations
Make a method getvalue in the collection
When you call getvalue,
if it's the last row in the collection (innermost loop which is incremented on every call) then
increment the index by 1
if we're at the highest value of the dimension, then
if we're not in the first row of the collection then
return to zero
increment the value of the index in the prior row (return to zero if necessary)
Return the value
Works like a charm
|
|
|
|
|
I don't know which .Net version are you using. If that is 3.0 or above, use LINQ it will surely help you get rid of some loops.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I want the Windows password at run-time achieved to bring,How do I do it,Is this possible?
All are successful
|
|
|
|
|
|
Your question isn't very clear at all.
If you're asking how you can get the users Windows password, you can't. There is no function you can call to get it, for obvious reasons.
|
|
|
|
|
Two choices:
1. It is you logged in. What, have you forgotten your own password! Your problem!
2. It is someone else logged in. You want to steal their password. We don't want to spend time in jail thanks.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hello My Dear Friends
Thanks for your response,
To my question :
I'm into Windows,I'd like to write a program that won the Windows password ,Would like the Windows password do I show a message box,
Whether it is possible?I wrote this program?
If the question is not clear, again say
Be successful
Mr Milad Biroonvand (M:B)
|
|
|
|
|
Do you really believe that Windows will allow you to steal passwords? You must be joking, aren't you?
|
|
|
|
|
Hello, my Hindi,(dear Mr Shameel)
I only question I,
Windows password hash is.It is not؟
Before start Windows ...is it posible ?Some programs have this feature.
I do not joke!!!
Be successful.
I am waiting for your reply
|
|
|
|
|
Hi People
i have a problem with my Excel VBA. i have a worksheet with all my sales data, and another worksheet with customer detail. Where the customer detail do hold a foreign key of the sales data. How am i suppose to search using the foreign key. As i'm trying ti use the customer details to check what did the customer did.
Thanks
Best Regards
Veon Cheng
|
|
|
|
|
Hi,
Im relatively new to this! So hello to everyone here .
I have been writing this code to allow combo boxes to dynamically create other combo boxes within the form, and then those ones to create comboboxes from themselves also. If this is a bit confusing here is the code I have been working on
Private Sub ComboBox1_Change()
Set optionComboBox = Me.controls.Add("Forms.ComboBox.1", newComboname)
With optionComboBox
.Text = "Please Select an option..."
.left = 100
.width = 290
.top = 125
While Not (IsEmpty(Range("'Info'!a" & Counter)))
Y = Range("'Info'!a" & Counter).Value
If InStr(1, Y, "DM|") > 0 Then
If InStr(1, Y, "DM|SH|") = 1 Then
Else
optionComboBox.AddItem (Range("'Info'!b" & Counter).Value)
End If
End If
Counter = Counter + 1
optionComboBox.SetFocus
Wend
End With
And the problem I am having is that I cannot reference something in VB that has not yet been created.
E.g. I wish to do something like this
Private Sub newComboname_Change()
While Not optionComboBox.Text = "Please Select an option..."
Set optionComboBox = Me.controls.Add("Forms.ComboBox.1", "ComboBox" & ComboboxNumber)
With optionComboBox
.left = 100
.width = 290
.top = 165
While Not (IsEmpty(Range("'Info'!a" & Counter)))
Y = Range("'Info'!a" & Counter).Value
If InStr(1, Y, "DM|") > 0 Then
If InStr(1, Y, "DM|SH|") = 1 Then
Else
optionComboBox.AddItem (Range("'Info'!b" & Counter).Value)
End If
End If
Counter = Counter + 1
optionComboBox.SetFocus
Wend
End With
Wend
End Sub
newComboname being the new combo box that was created on the Combobox1_change event.
Is there a way to reference this in a Sub? Or any other way will do really!
Any help would be appreciated!!
modified on Monday, November 16, 2009 11:22 PM
|
|
|
|