|
Thanks for the answers. I'm still experimenting, but the really helped push me in the right direction.
|
|
|
|
|
want to know how to connect a database to VB.net with codes
|
|
|
|
|
|
http://vb.net-informations.com/[^]
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
How can I set an image file as the user's desktop background image?
Thanks
|
|
|
|
|
|
|
I'm not good at English.
Look at this registry key
HKEY_CURRENT_USER\Control Panel\Desktop
You can find a lot of values in this key. The value named "WallPaper" contains path of the desktop background image. Some of other values describe how should the image be displayed.
Use My.Computer.Registry.SetValue(keyname as String, valueName as String, value as Object) to change the registry.
This is an example code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper", "D:\1.jpg")
End Sub
When you click the Button1, it changes your desktop background image path to "D:\1.jpg"
Good luck!
chilinhhacker
|
|
|
|
|
|
Does anybody have any insight on audio streaming through a tv tuner in a vb app? I'm using a directshow2005.dll. I have the video end of it working fine, but the audio does not work. Is there a way to check the graphBuilder or the assigned pins? Or does anybody have any better suggestions? Maybe an updated dll or or completely different one? I was reading some other forums and this seems to truly be a tough topic in everything before 3.5 .net framework.
|
|
|
|
|
Being quite new to VB.NET, I hope someone can guide me through big confusion with BackgroundWorkers.
In my project I have a Main form which holds several backgroundworkers:
1. BGW1 uses a class to collect files into a list of fileinfo (class property)
2. BGW2 processes the files from the list, considering which action to take (copy, convert, etc.)
Meanwhile I think I wouldn't even have to use two separate BGWs for that, but that's not the bigger problem. One of the actions taken in BGW2 retrieves header data from the processed file, which I want to show in a separate form ("frmDump")... and here the trouble begins :
Calling frmDump from the process running in BGW2 shows the form filled with the data, but then it hangs... (the error message is something like the program couldn't communicate with Windows anymore). So I tried using a third backgroundworker BGW3 (member of the main form) and called it from the BGW2 process with the command "mainform.bgw3.RunWorkerAsync()". This way, the form doesn't even fill with data anymore but hangs while opening...
I guess I'm really confused about the issue. Can someone please help me out? I hope I'm at least clear enough that you know what I mean
Thanks
Michael
|
|
|
|
|
Hi,
Threads (all kinds of them, including ThreadPool threads, and BackgroundWorkers) other than the thread that created a Control (BTW: a Form is also a Control), should not access that Control, except for the very few members explicitly allowed, including InvokeRequired and Invoke.
Before .NET 2.0 the app may behave badly, the GUI may freeze, anything can go wrong if you violate the rule.
Since 2.0 you get an InvalidOperationException by default; you can disable that by setting Control.CheckForIllegalCrossThreadCalls false, but that is a very bad idea, and it brings you back in the previous situation.
Since most if not all Controls are somehow related (they are on a Form, one Form owns another Form, etc), the natural consequence is all Controls get created and accessed exclusively by a single thread, typically your initial or main thread, often also called the "GUI thread".
There are lots of examples on InvokeRequired/Invoke available everywhere;
a rather advanced article on the subject is here[^].
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thanks, Luc. I've been reading a lot now and walking through C# examples with my little VB knowledge (BTW I just loved the Asynchronous Method Invocation[^] one).
Still the most important thing in my particular situation is unclear to me: From my main thread (ID10) I start a BackgroundWorker (e.g. it gets ID6) and within this thread I tried to start another BGW which is supposed to open a form (frmDump). From my efforts to trace the IDs I assume it uses the same thread ID (ID6) instead of getting a new one? If so, then this might very well be the reason for the freezing form, right? The first BGW finishes thread ID6, killing the forms instance which I intended to start in a new thread...
Would you be so kind as to give me some example code lines?
Thanks,
Mick
|
|
|
|
|
Hi,
as I said before, all GUI stuff must occur on the main thread, hence NOT on a BackgroundWorker. It just will not work reliably, or not at all, or only for some time. It is WRONG.
Don't bother with thread ID's, you cannot get it right unless you do all GUI stuff on the main thread, no matter what they tell you, it is bound for failure.
FWIW: BackgroundWorkers run on ThreadPool threads, as I have documented here[^].
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thanks again, Luc - but you made it clear already. I might be expressing misunderstandingly, so I have to ask you again, hoping you're in a buddhist kind of mood
The message WHAT I would have to do has become a bit clearer after the articles, but HOW would I do it?
Trying it in other (and hopefully better) words here's my challenge again: I have a certain condition (tested in the first BGW within a 'process filearray' method) which should effect (run by who ever as long it's not me ) in a new form, using the relevant fileinfo object from the BGWs method. This new form has to be independent from the main form (i.e. not blocking it while doing it's own stuff), that's why I tried a separate thread / BGW.
Somehow it doesn't seem very elegant returning a fileinfo object back with 'reportprogress' and then start another thread using that same fileinfo as its parameter... or is that the way to make it work? Do I even need a separate thread for the new (independent) form?
Regards
Mick
|
|
|
|
|
Hi,
Forms don't need threads, they can't make good use of threads, since anything that happens to a Form (i.e. calling properties and methods of Controls) has to be executed by the main thread.
Classes in general may make good use of threads for things that take long or might take long, such as complex computations, networking, large file operations, database accesses, etc.
So you should design your class/classes as if they were running on the main thread; then isolate the long running stuff and delegate that to another thread or BackgroundWorker, which could feed back intermediate results to the main thread for showing them on a GUI. There is an infinite number of ways to do that. If a lot of results need to be fed back, you could design a small "Results" class, have your BGW create and fill an instance, then put it in some queue, and have the main thread get it and process it, i.e. display it. You may or may not use the Progress event for that, I typically don't use it; instead, I often tend to create a delegate and call that.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Ahaaaa - that's basic information I needed for some ideas how to unblock the main thread of my brains again I'll redesign asap and consider the way you recommended to do it!
Thanks and regards,
Mick
|
|
|
|
|
hi,
i did simple db connect with server and client across LAN.
actually i pass connection string from global file.
how to give server location for client side during run time.
or give some other suggestion.
plz
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
We used to connect to the MS Access file through the network.
What you need is the shared folder over a LAN where DB file is placed
Now to access the file give path as
\\<IP Address>\<Folder Name>\<File Name>
|
|
|
|
|
well, i have a similar issue that i am working on. maybe this will work on Win XP OS's..
but i tried it on my Win Vista and 7, i get an error that says. cannot open DB, restrictions are blah blah blah..you do not have enough permission. but the folder/file is shared with full read/write control.
even in my Xp workstation, sometimes i get the same error. maybe because there are a lot of computer trying access the db simultaneously?
any ideas on Win Vista and 7?
|
|
|
|
|
All you do is change the connection string to reflect the name of the new server. It's nothing more than simple string manipulation. You can create your connection string with a well-known tag in place of the server name, then just search for and replace the tag in the string with the name of the server. The result is your updated connection string.
|
|
|
|
|
Hello,
i am trying to export data from a vb.net application to an excel spreadsheet. It works but somehow some of the variables are right aligned in their field.
Is there any way to algin a whole column to the left.
I am using Microsoft.Office.Interop
|
|
|
|
|
Worksheet.Columns.HorizontalAlignment property should do that.
Or
((Range)WorkSheet.ColumnsObj[Type.Missing, "A"]).HorizontalAlignment
Not tested though.
|
|
|
|
|
Thanks!
Worksheet.Columns.HorizontalAlignment = = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft
Worked perfect.
|
|
|
|
|
I have an exe application which is on vb6. I want to remotely push it into different machines and run it as a service there.This service should start as soon as the user logs into his machine.
Please tell me if it can be achieved and how to do it? Thanks.
|
|
|
|