|
Hi All,
I am using a windows service to watch some folders and then process the files created in that folder. For this i am using the FileSystemWatcher. Now the problem is that i want to set the SynchronizingObject property of FileSystemWatcher, but i dont know what should be set to it. I am not using the FileSystemWatcher control, ie i have created an object am using it to watch the folders.
So please, if any one knows what value should be set to SynchronizingObject property let me know. I searched on net, but every time i saw a Form was set to the SynchronizingObject property. But how can i set a Form in a windows service ? And also what would be the use of SynchronizingObject then?
Please reply as soon as possible !
Thanks
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Anant Kulkarni wrote: i want to set the SynchronizingObject property of FileSystemWatcher, but i dont know what should be set to it.
The the SynchronizingObject just tells the FSW which thread will get the FSW events marshalled to it. It can be set to any object that implements the ISynchronizeInvoke interface. You can easily tell this if the object you want as the SynchObject has a BeginInvoke method.
Basically, if the FSW is created on a seperate thread from the the that's going to handle the events that FSW raises, you need to set the SynchronizationObject .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
When a system event occurs I want to bring my application to the front of all other active windows and give it focus.
I've just used the me.activate() command.
This works fine on my XP machine, but on a 2000 machine, the application is not brought to the front, the icon just flashes in the task bar.
Any ideas on what I might be doing wrong here??
|
|
|
|
|
It's doing exactly what you told it to do.
If you read the documentation on Form.Activate() method, you find that it says: "Activating a form brings it to the front if this is the active application, or it flashes the window caption if this is not the active application."
You're probably looking for the AppActivate() method of the Interaction class, buried in the Microsoft.VisualBasic namespace. Docs on it are here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello
I am new at vb.net & ado.net so how can i get practical information about database programming pojects
|
|
|
|
|
Yes - buy a book. Or use google to find online articles on the subject.
Also, if you're new to BOTH VB.NET and also databases, learn VB.NET first, then worry about SQL and databases.
Finally, don't be discouraged that you were downvoted, if you do some work and ask questions as you get stuck, people here will be happy to help you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello all,
I want to do streaming of video file using vb.net. How I do this?
|
|
|
|
|
First, you download the Windows Media Encoder 9 SDK, here[^]. Then you go through the documentation on it, complete with code samples, here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there,
Actually i'm creating question & answers for the student iQ assessment.
I'm using images as a question's. so wnenever image loaded in the form it only can appear for 10 seconds if the user didn't respond within 10 secs it will go to other image likewise for all the images.
So now i can start the timer but i could restart the timer when the 2nd image appear. i can't use any command button to stop or restart. is there any way to do it.
Pls Help me.
Thanx in advance.
|
|
|
|
|
This is pretty simple if you think about it.
You need to write method to get the next question and setup the form. This method then sets up the Timer for 10000 milliseconds (10 seconds). Then enables the Timer.
In the Timer's Timer event, you call that method again, forcing the page to be update with the next question.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave,
Thanx fr ur rply. so basically there is few levels in the test. Each level there are arnd 10 images. For every level i'm using 1 form.
Currently i using the 1 timer only & i set the timer interval as 1000. c the code there
private form1_load()
image1.picture=Loadpicture("C:\images\apple") 'question 1
End Sub.
Private sub form1_keypress(keyascii as integer)
if (keyascii=65) then
image1.picture=Loadpicture("C:\images\bus") 'question 2
if (keyascii=66) then
image1.picture=Loadpicture("C:\images\Cat") 'question 3
if (keyascii=67) then
score=3 'score is a global variable
form2.show 'GOTO LEVEL 2
me.hide
else
score=2
endif
else
score=2
endif
else
image1.picture=Loadpicture("C:\images\apple") 'repeat the question
if (keyascii=65) then
score=1
else
score=0
endif
endif
//if (timer1=10)
image1.picture=Loadpicture("C:\images\bus")
else if (timer1=20)
image1.picture=Loadpicture("C:\images\cat")
endif//
so now i don't know how to set the timer event. According to the code here Let's say if the user answer below 5 secs for the que 1,it will give 15 secs to answer the que 2. which is not correct.
pls me help to solve this.
Thanx.
Regards
|
|
|
|
|
I'm afraid you'll have to scrap ALL of this code. It won't work with a timer at all.
You have to store all of the paths to these images in an array. You'll also have to store the correct answer in that array. You'll proably need a class-level variable to store the current index that's being shown in that array. Then you can setup a timer. Maybe something like this:
Do NOT copy and paste this "code"!!
Public Class Form1
Private currentIndex As Integer
Private flashCards(4,1) As String
Private Sub Form1_Load()
' The first dimension is the filename of the question picture,
' The second dimension is the correct answer for that question.
flashCards(0,0) = "C:\images\apple"
flashCards(0,1) = "A"
flashCards(1,0) = "..."
flashCards(1,1) = "B"
flashCards(2,0) = "..."
flashCards(2,1) = "A"
flashCards(3,0) = "..."
flashCards(3,1) = "C"
' Set the current question number to 0.
currentIndex = 0
' Show the first question...
UpdateQuestionImage()
End Sub
Private Sub Form1_KeyPress(key As Integer)
If Str(key) = flashCards(currentIndex, 1) Then
' The correct answer was found!
currentIndex = currentIndex + 1
UpdateQuestionImage()
End If
End Sub
Private Sub UpdateQuestionImage()
Timer1.Enabled = False
image1.picture=Loadpicture( flashCards(currentIndex, 0) )
Timer1.Interval = 10000
Timer1.Enable = True
End Sub
Private Sub Timer1_Timer()
' Question was not answered in time!
currentIndex = currentIndex + 1
UpdateQuestionImage()
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
i have a problem in using crystal report in vb.net.
i am using stored procedure with crystal report.
iam assigning discrete value for parameter thro' coding. But only the field name comes in the report without record values when i run the application. when i give manual refresh in the report , the parameter input dialog pops . After giving the input value again the report is generated with the value corresponding to the input.
any one can help me in this regard.
ie with the value given in coding the report should generate .
thanks .
|
|
|
|
|
hi y'all,
the deal is trying to connect to MySQL server, am usin VB 2005 express. when intsallin the server i used my name as the password. accessed it n created a databse and table. then i coded the following just to test it;
Dim MyConstring As String = "DRIVER ={MySQL ODBC 3.51 Driver};" & _
"SERVER = localhost;" & _
"DATABASE = test;" & _
"UID = root;" & _
"PASSWORD =kumoyo;" & _
"OPTION = 3;"
Dim MyConnection As New Odbc.OdbcConnection(MyConstring)
MyConnection.Open()
MsgBox("database opened", MsgBoxStyle.OkOnly, "the 1 skills")
MyConnection.Close()
i assumed my user id is "root", coz when i type slash s i get see user root@local host.
am gettin an error when tryin 2 open the database. what am i doin wrong or what havent i done? i've already installed the odbc.net driver n all. help a brother out here!!!!!!!
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
70's live! wrote: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Have you installed the driver?
---
b { font-weight: normal; }
|
|
|
|
|
yes i installed the driver n its configured in the odbc administrator. when testin it from odbc administrator test is ok.
|
|
|
|
|
i dunno how to convert vb.net to vb6.....any idea?..
|
|
|
|
|
Why would you want to??
This is going to be a VERY difficult task. VB.NET (the .NET Framework) encapsulates functionality in standard classes that you would have to rewrite from scratch in VB6. There is no conversion tool. Basically, you'd be rewriting the ENTIRE app from scratch.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
LifeIsSad wrote: I need help...pls help....
A better subject line would be helpful to would be helpers. For example: "Convert between VB.NET and VB6" would be a better subject line.
|
|
|
|
|
You probably can't, and why would you want to ? Any non trivial program is likely to use libraries that are not in VB6.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Anyone know how to multi-select from a TreeView with VB.NET 2003 ?
Need help~! Thanks.
|
|
|
|
|
You can't. It's not supported...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there, you can try to create an array for each node in the treeview you have selected, and just change the back colour or use a different icon to indicate the selected nodes. You should be able to do that with a litle bit of codeing.
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
I found a TreeViewMS control with sample code that support multi-selection of treeview. It is kinda cool.
Thanks anyways.
|
|
|
|