|
Do you mean date and time of created file?
If yes you can use the FileInfo
Dim fil As New IO.FileInfo("Your File Name")
MsgBox(fil.CreationTime)
Shay Noy
|
|
|
|
|
Yes almost there.. but the problem is that i need to use the creation time and date to compare with the time and date now and if the file is 4 days old i have to delete it..
|
|
|
|
|
The rest is so trivial, you really need a VB.NET book if you don't know it.
DateTime.Now is the current date/time. If you subtract one DateTime from another, you get a TimeSpan which has a days property.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the advise. I have tried the code and indeed it can show the date but it needs specific URL. What i ask to do is to look through a folder and know all the date of the files inside.. I try edit to use .directory but was unsuccessful. Any other ways that i can do?
|
|
|
|
|
--> Its simple if you read the "File Handling" chapter in any book of vb.net..!
--> You are suppose to go through the folders and search files. How to do it. Its all in the above chapter...!
J A Nasir K
|
|
|
|
|
Summary of my problem:
I have a DLL which generates some messages. I want to pass back a message to a VBA in Excel with the callback function in VBA whenever the message is generated.
Here is what I tried, but encountered a problem.
I have a callback function implemented in a DLL, called Test.dll, written in C as
typedef void (*SHOW_MSG_T) ( const char *message );
void __stdcall SetShowMsg( SHOW_MSG_T func );
I declare the callback and call functions in the Excel VBA as
Public Declare Function SetShowMsg Lib "Test.dll" (ByVal pCallback As Long) As Long
Public Function CallbackShowMessage(ByVal strMsg As String) As Long
MsgBox strMsg
End Function
:
:
:
Dim lRet As Long
lRet = SetShowMsg(AddressOf CallbackShowMessage)
However, when the DLL calls back CallbackShowMessage, I get Microsfot Visaul Basic Run-time error '14': Out of string space in the VBA. I am not sure what's wrong. Maybe the strMsg string in the VBA is not initialized. If that's the case, how do I fix it?
Thank you very much in advance for your help.
Bill
Please email me any comment/suggestion at yuebiao_wang@yahoo.com
|
|
|
|
|
When you invoke the callback from your C code, pass it a global char[] array rather than one that's been allocated on the stack in your local function. That solved the same issue for me.
In other words, instead of this:
int void __stdcall SetShowMsg( SHOW_MSG_T func )
{
char message[1000];
sprintf(message, "something");
func(message);
}
^-- bad
Do this:
char message[1000];
void __stdcall SetShowMsg( SHOW_MSG_T func )
{
sprintf(message, "something");
func(message);
}
Or you could allocate it dynamically (not tested)
void __stdcall SetShowMsg( SHOW_MSG_T func )
{
char *message = new char[1000];
sprintf(message, "something");
func(message);
delete [] message;
}
|
|
|
|
|
--> I m developing a software which will work on a network.
--> The problem is that i want to store the creation date on which the customer is created but not from the software but from the server. How will i do this..?
J A Nasir K
|
|
|
|
|
Where are you storing the data, and what date do you want to store. If you are storing to a SQL Server database if you use the getdate() function it will get the server time. I expect Oracle would work in the same way. An alternative would be to use the UTC date.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Dear All,
I would like to know more if there are anyway to write a program to detect if there are replication of data.
Regards,
Kel
|
|
|
|
|
You can query the system tables in sql server, the information should be available in there somewhere.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
I have the following code which i have type for getting the use of refection for button class,
But I got following error
Object reference not set to an instance of an object.
<br />
Public Class Form1<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim pobjtype As Type<br />
pobjtype = Nothing<br />
Dim PobjObject As New Object<br />
PobjObject = Nothing<br />
Dim pobjButtons As New Windows.Forms.Button()<br />
PobjObject = pobjButtons.GetType()<br />
<big> For Each PobjObject In pobjtype.GetMembers </big><br />
LstDisplay.Items.Add(PobjObject.ToString())<br />
Next<br />
End Sub<br />
End Class<br />
<br />
Thanks in advance,
amit
|
|
|
|
|
You assign Nothing to the variable pobjtype, and then you try to use it as if it referenced an object.
Did you assign the value to the wrong variable on the line before?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Sorry I didn't get you. Can you please explain with the line code ?
Thanks
|
|
|
|
|
He means that you assign Nothing to variable: pobjtype = Nothing
and then you try to use it
for ... in pobjtype.GetMembers
Shay Noy
|
|
|
|
|
Good Day,
I am busy writing a I2C communication link through the printer port. I need to set up a square wave of 100-400kHz for the I2C clock signal. This is for an EEPROM programmer.
I was going to use the windows timer, but the interval only goes down to 1 ms. I need an interval less than 10 to 2.5 nano second.
I was trying to use system.timers.timer, but am not sure if this is the correct class for what I need to do.
Is there another way to create and interval or a delay in vb.net?
Is there an example implementation for sytem.timers.timer?
Here is my code for system.timers.timer:
Public Class Main
Dim WithEvents myTimer As New System.Timers.Timer
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myTimer_Init()
AddHandler myTimer.Elapsed, AddressOf myTimer_Run
End Sub
Sub myTimer_Init()
With myTimer
.Interval = 0.001
.Enabled = True
End With
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
myTimer.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
myTimer.Stop()
End Sub
Dim counter As Long
Sub myTimer_Run()
counter += 1
TextBox1.Text = counter.ToString
End Sub
End Class
Error at runtime: Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on.
|
|
|
|
|
My math was wrong above. its 10 to 2.5 microseconds.
|
|
|
|
|
Microseconds... Damn.. Uhm
10^-6..
0.001 ms...
Afaik, VB only works in ms. And then only down to somewhere near 50 or so as an interval for the timer class.
So, if you're gonna do that, with microseconds, you'll need another language.
|
|
|
|
|
Hi,
i have a contextMenuStrip control with 5 items. I can change its forecolor and backcolor easy like
contextMenuStrip1.Forecolor=color.Yellow.
How can i change the color of the selected item when i am on it?
I mean when i select for example forth item, there is a different color that shows/indicates on which item i am on.
How do i change this color?
Thanks in advance
|
|
|
|
|
By inspecting the menuitem object you will see that there is no fore/back color property so you are not going the set these in the standard object.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No, you make mistake. Both in System.Windows.Forms.ContextMenusStrip and in System.Windows.Forms.ToolStripMenuItem there is a forecolor and backcolor property, and for sure i can set those 2 colors because i already do.
How do you know on which MenuItem you are on, while you have not yet click on any and you are just browsing? You know it, because on this MenuItem you are on, it appears something like a 'selection' that has a different color. This color i want to change!
|
|
|
|
|
hey frnd MD4 unction is not inbuilt. I do not know from where to start.Can somebody plz frd me the coding. I will be very greatful to you.
|
|
|
|
|
Googled this[^] in seconds....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Could you please repost again, Sonia?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
hey frnd MD4 unction is not inbuilt. I do not know from where to start.Can somebody plz frd me the coding. I will be very greatful to you.
|
|
|
|