|
I have a label control and I want to modify its text from within a thread (example shown below), but I get a runtime access exception. How do I access controls from a thread?
Imports System.Threading
Imports System.Threading.Thread
Public Class Form1
Public thrd As New Thread(AddressOf MyThread)
Public counter As Integer = 0
Public Sub MyThread()
Do
counter = counter + 1
lblThreadCount.Text = "Thread Count = " & counter
Sleep(100)
Loop While 1
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblThreadCount.Text = "Thread Count = " & counter
thrd.Start()
End Sub
Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
thrd.Abort()
End Sub
End Class
|
|
|
|
|
Add the following line to the top of the Form1_Load event:
Control.CheckForIllegalCrossThreadCalls = False
|
|
|
|
|
how to get how many capacity the hard disk have? for example 80 GB!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Assuming the .NET Framework 2.0, you're looking for the DriveInfo[^] class and it's TotalSize property.
In using .NET 1.x, you can get it using the WMI Win32_LogicalDisk class and the System.Management namespace.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I need to parse a string that contain the following formats:
xxxxxxxxx + <space> + nn + nn //ignore the rest
xxxxxx //a series of strings
Having gone through the .split method it seems to be suitable for this type of task, but what algorithm(s) would you suggest for implementing it?
Jon
|
|
|
|
|
If your goal is something more complex than 'break each bunch of characters that doesn't contain a space into a string', you probably want to use regular expressions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi!
I would like to know if anybody has a source where you can send data through an already established connection by hooking into it?
Greetings .. Mik
|
|
|
|
|
You can't do that by "hooking into" the existing socket. There's no way to get at the socket once it's been created by another app.
You can, however, write a proxy server, where your application can connect to your server, then your server forwards the requests on to the real game server. Then you've got a "man in the middle" way of looking at all the traffic and injecting your own.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The other solution I can think of is an NDIS driver (similar to the way software based firewalls hook into network traffic). But they are fiddly to write as you get the packets at a really base level fresh off the network before anything has had a chance to process them.
|
|
|
|
|
Yeah, I didn't even want to go there for this.
10 bucks Aussie says this question is for some kind of game overlay!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The other solution to Dave's suggestion that I can think of is an NDIS driver (similar to the way software based firewalls hook into network traffic). But they are fiddly to write as you get the packets at a really base level fresh off the network before anything has had a chance to process them. Also, you can't write one in VB or VB.NET. I wrote one some years ago in C.
|
|
|
|
|
Hello,
Using VB.NET, I have populated a dataset that reads records from table tblCustomer that resides on the network (SQL Server 7.0). How do I take the records from that dataset(SQLDataset), and store it in a local table called tblCustomer(SQL Express Edition)?
Keeping in mind, my tables, tblCustomer, has about 52 columns, so if I can some how just import the data in one shot as opposed to using the .NewRow methods...
myNetworkSqlDataAdapter.Fill(SQLDataset)
Thanks in advance.
|
|
|
|
|
how to check were the program files are on?? C:/ or D:? how to check it please??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
ADY007 wrote: how to check were the program files are on?? C:/ or D:? how to check it please??
The program files need not be on the primary drive, and the name of the folder will be localised for the language version of Windows.
You need to read the following documentation:
* Environment.GetFolderPath()[^] - This has a code sample you might find useful
* Environment.SpecialFolder[^] - This has details of all the other folders to which you can find the location.
|
|
|
|
|
how to unzip a zipped file using the vb.net?
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
This[^] might work with a bit of teasing.
|
|
|
|
|
thanks alot my friend
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
|
how do i retrieve data from sql and cut it to 20 characters to display it in a text box. The data in about 100 chatacters in the database but i only need 20.
Please help
|
|
|
|
|
Off the top of my head I'd say pull the data in as normal & perform editing on it using string methods.
Are you looking for a particular bit of string in the data you're pulling through? How do you know which 20 characters it is? The first 20? A bit more explanation please.
|
|
|
|
|
I am looking for the first 20 characters. from character 1 to 20.
Hope this is clear.
|
|
|
|
|
Assuming your reading the data as string, use the Substring method on your data e.g. txtResult.Text = strSQLData.Substring(0, 20) .
|
|
|
|
|
thank you.
It works perfect.
|
|
|
|
|
hi,
how can i save a word file into database and import that file into word and do editing and again save into the database
|
|
|
|
|
Wouldn't it be easier to save the Word files as is and just reference their paths/build a schema of the file system where they are stored? Your ability to edit & save the files would be much easier as well.
|
|
|
|