|
Here are the value for st :
wDay: 31
wDayOfWeek: 5
wHour: 23
wMilliseconds: 0
wMinute: 0
wMonth: 12
wSecond: 0
wYear: 3604
whith wich values are you testing?
Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
|
|
|
|
|
OK. This should do it. The problem is that the bitwise math isn't working as it should because one of the value types in the FILETIME structure isn't what it appeared to be.
Dim dt As New DateTime((ft.dwHighDateTime * (2 ^ 32)) + ft.dwLowDateTime)
I'd beat the snot out of this code before putting it into production.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 19:42 Thursday 13th April, 2006
|
|
|
|
|
Hi Dave,
Fixed it in a more convential way ... :
Private Shared Function SystemTimeToDateTime(ByRef st As SYSTEMTIME) As DateTime
Dim dt As DateTime
Dim dtFormat As String
Dim en As New CultureInfo("en-GB")
dtFormat = "dd/MM/yyyy HH:mm"
With st
dt = DateTime.ParseExact( _
Format$(.wDay, "00") & "/" & _
Format$(.wMonth, "00") & "/" & _
Format$(.wYear - 1600) & " " & _
Format$(.wHour, "00") & ":" & _
Format$(.wMinute, "00"), dtFormat, en.DateTimeFormat) ' & ":" & _
' Format$(.wSecond, "00"), dtFormat, en.DateTimeFormat)
End With
Return dt
End Function
Gues it is a bit less efficient, not sure how much though.
Your remark about the code and the snot was that just about this problem or also about the rest of the code. If so could you give me some pointers, guess it is never too late to learn. )
Cheers
David
Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
|
|
|
|
|
Hi How can I open and read msg file information such as from, to, subject, location, when for appointment and body programmatically?
i tried to use redemption but I'm missing some information such as location and when for appointment.
how many type of attachments in email?
When I try to read email attachment, I would like to know what type of attachments are?
|
|
|
|
|
You'll have top open this file in the application that wrote it. I take it your using Outlook? Outlook has a COM-based object model that can get this information for you. This[^] article on MSDN should get you started.
pnpfriend wrote: i tried to use redemption
Redemption?? Are you praying for this to work? Are you in need of forgiveness? We can't really handle issues of the faith here at CP.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes I'm trying to use redemption[^]
to get the msg file information such as To, From, Subject, Body and if the msg file is appointment file, I'm trying to get Location and Start time of that appointment.
But I dont know how to get the appointment date, time and location.
|
|
|
|
|
pnpfriend wrote: to get the msg file information such as To, From, Subject, Body and if the msg file is appointment file
For that, you're going to have to get ahold of the people who wrote Redemption and ask them. From what I can see, RDO doesn't support Appointment objects. SafeAppointmentItem looks like it supports what you want, but the documentation isn't exactly complete.
As far as attachments go, Outlook doesn't care about what the file types are. So, you'll have to get the filename of each attachment, specifically the .extension, and P/Inokve Shell functions to lookup what that extension is registered to.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello
I am new to .net.
I need to know the following information.
1.How to declare global variables.
2.where to declare ( in VB6 used to declare those in Modules what about 2005?)
3.How to make the application Run the Sub Main() function?( I saw in VS2005 My Project Tool and it shows only forms which are in the projects and it didnt show the module which i have added which contains a main function and i have tried to add a class and tried the same and still no luck.
5.How to end the application Frmmdiform.END?
Thanks for the reply in advance
Regards
Help in need is the help indeed
|
|
|
|
|
percyvimal wrote: 1.How to declare global variables.
Global variables don't exist in the .NET Framework. They're also bad practice. You can simulate something close by declaring your variables as Shared in another class:
Public Class HelpersLibrary
Public Shared myGlobalVariable As Integer
End Class
percyvimal wrote: 2.where to declare ( in VB6 used to declare those in Modules what about 2005?)
Modules are an outdated concept. They're only there for backwards compatibility with VB6.
percyvimal wrote: 3.How to make the application Run the Sub Main() function
You actually have to turn off the "Enable Application Framework" option in My Project before Sub Main will show up in the list. After that, all you have to do is supply a Sub Main in either a Module or a Class. For a Module, add a new one to your project, then put something like the following code in it:
Module MainStartupCode
Public Sub Main()
' Your startup code begins here
' To launch a form and start your Windows GUI:
Application.Run(New mainForm)
End Sub
End Module
Or, to support command line arguments:
Module MainStartupCode
Public Sub Main(ByVal cmdArgs() As String)
' Your startup code begins here
' To launch a form and start your Windows GUI:
Application.Run(New mainForm)
End Sub
End Module
Now, you don't have to have a Module to supply a Sub Main . You can do it with a Shared member Sub of a class:
Public Class Form1
<STAThread()> _
Public Shared Sub Main()
' Same as above examples...
End Sub
' the rest of your form code goes here...
End Class
Don't forget to go back into MyProject and select Sub Main < from the Startup object dropdown.
percyvimal wrote:
What happened to 4?
percyvimal wrote: 5.How to end the application Frmmdiform.END
Me.Close()
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much Mr Dave
That is great explanation.I am still in the world of VB6 and so need to crawl to get into the world of .NET and people like you i hope will take me in the right direction.
Sorry for the Numbering Error.
"You actually have to turn off the "Enable Application Framework" option in My Project "
This helped me a great deal for i was scratching my head why submain was not listing in the dropdown.
Regarding No3:
Now, you don't have to have a Module to supply a Sub Main. You can do it with a Shared member Sub of a class:<br />
<br />
Public Class Form1 <STAThread()> _ Public Shared Sub Main() ' Same as above examples... End Sub ' the rest of your form code goes here...End Class<br />
<br />
According to your example Form1 --should be the start up form?Could you able to explain how it works.I assume my Sub Main will be triggered first where whatever i wrote as code will be executed and then formLoad event?
Me.Close()= ME.END in VB6 ie does it free up the application from memory?
You have suggested that using global variable is not such a good practice and i have read in some article also that it is not a OOPS concept to have global variables.
So what is the best and alternative way. Do i need to create a class with get and set parameter in a class to store that values? I would like you hear from you what is the best method to be followed to keep global variables?
Thanks and Regards
Help in need is the help indeed
|
|
|
|
|
percyvimal wrote: According to your example Form1 --should be the start up form?
A Shared sub can be called without an instance of the class that contains it. Once the Sub Main is created inside ANY public class in your app, you can set it to the be Startup object in the MyProject properties.
Me.Close will close the form that it shows in. If this is the only form in your app, then it will send the WM_CLOSE message to itself. Or, you could replace it with Application.Exit and it will close your entire application, no matter what form it's called in.
And, yes, all the (managed) memory your app uses will be freed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Another method. Create a class like below
Public Class clsGlobal
Public Shared Caterory As String 'Global variable for current programm-mode Audio or Video
Public Const const_SqlExtAudio As String = "SELECT Media_Extensions.MediaExtension, =" + _
"Category.Category FROM Category INNER JOIN Media_Extensions ON Category.ID = " + _
"Media_Extensions.bez_Catgory WHERE (((Category.Category)='Audio'));"
End Class
to access the variable e.g. Caterory :
clsGlobal.Caterory = "Test"
|
|
|
|
|
Thank you very much mr Dave and Cosma, with your help i am getting into .net now and really appreciate your nice explanations and very useful information.
with regards
Help in need is the help indeed
|
|
|
|
|
i send a vairable to another application but some time the variable damage and add some thing diffrent ... i dont know why ...
for example :
dim s as string ="4294:DN"
windows.minimaiz
send.sendwait("s")/ print in active window
windows.maximize
the problem the first time print the s as 4294:DN on the another window but aftet repeat the action of print the variable will print some thing deffirent like 44294:::DN
why the variable change ??????????
kilany
|
|
|
|
|
Mr kilany wrote: i send a vairable to another application
How are you doing this? There's only about a dozen different ways...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i send variable by this fuction
dim ss as string = textbox1.text // here imagen i put "2415666:"
/// here code whcih minimaze the form of vb.net
System.Windows.Forms.SendKeys.SendWait("ss")// here the code which different and change . and after many click of button which make this action the string will print as "245566654" or some thing wrong .. the question why the variable printed like this ....
///here code whcih minimaze the form of vb.net
kilany
|
|
|
|
|
Copy and paste the ACTUAL code, don't retype it here.
What your saying is happening is impossible from the code that you've posted.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Try
Dim cone As New Conection
Dim ii As Integer = ds.Tables(0).Rows(ComboBox1.SelectedIndex).Item(0)
Dim sh As String = cone.get_Special_data("select Switch_Access_Code from Swiches where Swich_ID=" & ii & "")
b2 = ""
b2 = sh
Me.WindowState = FormWindowState.Minimized
System.Windows.Forms.SendKeys.SendWait(b2)//b2="2494:" come from //database on sql server
Me.WindowState = FormWindowState.Normal
b2 = ""
Catch ex As Exception
MsgBox("الرجاء اختيار القسم")
End Try
End Sub
some times when i click on this button will type on active window 4294: but aslo some time type 44294: and some time 4294:: and some time 4294: and some time 4449942: althought the data which comes from data base is just 4294:
why the variable b2 some time print wrong data not as want ???????
kilany
|
|
|
|
|
Don't make me repeat myself....
The problem is not the variable, but the method in which your code is TYPING it into the other application. I just got done telling you that you've chosen, possibly, the worst method to pass data to another application. SendKeys is NOT guaranteed to put the data into that TextBox exactly as sent. This is because SendKeys cannot control how the keystrokes you're sending are processed by the other app.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dear.
sorry ... but can you give me a best method which pass data to another application ...
really i need to use it ...and the way to use it ?
kilany
|
|
|
|
|
The best method is if the other application exposes a COM object model to use. Other that that, the possibilities get very complicated. If you're putting text into a TextBox, then you could find a way to get the window handle of the target window and use WM_SETTEXT to fill in the TextBox. Google for "WM_SETTEXT FindWindow" and you'll come up with some examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i dont need to write in note pade and the another application read from it. i need to use the sendwait() method but the problem what happed ? really i dont know maybe i shoudl add timer to the button action to slow down the transfer of data from vb.net to another application ..so i need the solution .. because i work with seminar project and i have a 1/5 as a dead date .. the problem is transfer a data from vb.net to another application without any changes of data..
please i send more than 12 to get the answer but still at this moment without a correct soluation...please help me.
kilany
|
|
|
|
|
No matter what, SendKeys cannot control how the destination application processes the keys sent to it. You can slow it down using a Timer, but I seriously doubt that it'll do you any good.
If you really want to use SendKeys, you'll have to pay VERY close attention to how you other application behaves and how each control behaves when it gets the focus from your app. Then you'll have to modify the key string you send to account for being in the wrong control or to make sure the focus is in the correct control and the insertion point is in the correct position before you send any data. Even then, you can't guarantee accurate results. This is because ANY keystroke or mouse click anywhere on the screen during the SendKeys command, or before the target app processes the keystrokes can seriously screw up what you sent.
The bottom line is there is NO RELIABLE METHOD TO DO THIS!!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi this is a very simple question.
but i'm not getting the ouput.
please some body can send me the code of bind the datagrid with diplaying the image in the datagrid from database.
plz its urgent.
byeeeee
|
|
|
|
|