|
Hi, you could find more information on this subject in my timer article. See link below.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
I am just tired getting this error "Object reference not set to an instance of an object" in my project. I know that to solve this error you can use New keyword but I don't think that "new" can be used with Thread. Some code is as follows:
Private thrDownload As Thread
<br />
'''''' Some code is here'''''''''''''<br />
'<br />
'<br />
'<br />
'Now On This line I am getting an error :<br />
<br />
thrDownload.Start(0)<br />
<br />
' Or On thrDownload.Pause(0) & thrDownload.Stop(0) the same error !<br />
'<br />
'<br />
'<br />
'<br />
'''''' Some code is here'''''''''''''<br />
<br />
If anyone wants then I can paste the whole code here but It's lots of lines of code ! :->
Any Suggestions ?
Thanks,
Dan
|
|
|
|
|
Dan`M wrote: I know that to solve this error you can use New keyword but I don't think that "new" can be used with Thread.
Yes, it can. You have to create the Thread object before you can use it.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
sorry but can you show some example code please.. :->
|
|
|
|
|
Yo,
I have an datagrid where I want to filter my data I got.
The filter I want to use is the text inside an combobox or textbox (it doesn't matter)
This is the code I already have
Private Sub cmbPO_textChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbPO.SelectedValueChanged
Me.TblLijstBindingSource.Position = Me.cmbPO.SelectedIndex
End Sub
Where:
cmbPO = combobox
tblLijstBindingSource = binding source
This doesn't works like I want it, I want to see just the record I've insert in the combobox. But if this is to hard to do, it may just jump to that record.
Thanks
(Plz keep in VB.NET and do not throw code of C# or such a languages :->)
|
|
|
|
|
Hello,
To achieve this, you would have to use the filter property for the binding source. You will have
to specifically put the filter condition on the field whose value you will enter in the Text box.
You can use the following code in the TextChanged event of the Combobox or the Text Box:
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged<br />
<br />
Me.TblLijstBindingSource.Filter = "<Column Name> ='" & Me.ComboBox1.Text & "'"<br />
<br />
End Sub
I believe this should help.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Thanks for your help but still got an error :
Syntax error: Missing operand before '=' operator.
Btw how do you search for a value who is in a datagrid who is dynamic created.
I mean how can you bind a dataset to the datagrid, and not the datagrid to the dataset.
Thanks
|
|
|
|
|
Hi All,
This is the first time, am posting a query on any forum.
I've developed an application in which there is a hot key assigned to each button. In VB.Net I came to know there is no need to press Alt to activate the hot key which is known as an Access key (correct me if am wrong). But problem is like this when my application is open and control is on my application and by mistake if I pressed any button for eg. on Exit button, I've written E&xit so it's a hot key when I pressed Alt+x, but according to Access key if I press 'x' then also it works as Alt+x and it takes me out of the application. So I wanted to deactivate the access key, it should work only when I pressed Alt+x.
Please advice me.
|
|
|
|
|
|
Sorry to be a pain, but I just can’t find this:
I can load an assembly from a .dll:
Dim Asm As Assembly = System.Reflection.Assembly.LoadFrom("c:\test.dll”)
But then I can’t unload the assembly
So I tried:
Dim newDomainName As AppDomain = AppDomain.CreateDomain("newDomainName")
But NewDomainName doesn’t have a loadfrom method
How to create the assemblyref foo required as the argument in:
newDomainName.Load(foo)
Thanks
|
|
|
|
|
hi well the title is pretty self explanotary.....I'm just trying to insert a row after the currently selected row in a datagridview programatically? anybody please help with this
Mr Oizo
|
|
|
|
|
If the grid is bound to a datasource, you don't add the new row to the datagridview. You add it to the datasource, probably a DataTable. How you do that depends entirely on your datasource.
|
|
|
|
|
Hi all i want to send the Email using VB6 but without using the Outlook Application how could i do that plz reply with code.
with regards
yogesh agarwal
|
|
|
|
|
look up either cdonts or cdosys dlls
|
|
|
|
|
Thanks for your reply but i tried a lot i could n't find the method how to use these DLL in my VB program to send the email could you help me out.
with regards
yogesh agarwal
|
|
|
|
|
Keep digging....
CDOSYS.dll
http://support.microsoft.com/kb/310212
CDONTS.dll
http://www.2enetworx.com/dev/projects/view.asp?ids=1,67,2
|
|
|
|
|
Check out Blat.
This is a freeware mail program that is command line driven - so you should be able to quite easily integrate it into your code.
I use this to automatically send out emails to suppliers notifying them of payment transfers.
You always pass failure on the way to success.
|
|
|
|
|
Thanks for your reply but i tried a lot i could n't find the method how to use the BLAT in my VB program to send the email could you help me out.
with regards
yogesh agarwal
|
|
|
|
|
I'm okay helping you with specific questions.
As a hint - you will need to use the shell to execute the blat commands as it is command line driven.
I don't consider just over one and a half hours, between my post and your reply, as worthy of the phrase:
yogesh_kumar_agarwal wrote: tried a lot .
Beyond this please be more specific with where you are stuck.
You always pass failure on the way to success.
|
|
|
|
|
If you were using VB.NET, this would be trivial. The other option that sprngs to mind is MAPI ( which can use outlook express, I belive ), but I have no idea if VB6 supports it in any way.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
With the help of Pete (earlier post) I am able to read & display return lines then close a process through command line (MS-DOS window) with the following codes:
<br />
Dim ps1 As New Process<br />
<br />
ps1.StartInfo.FileName = "cmd.exe"<br />
ps1.StartInfo.WindowStyle = ProcessWindowStyle.Normal<br />
ps1.StartInfo.CreateNoWindow = False<br />
ps1.StartInfo.UseShellExecute = False<br />
ps1.StartInfo.RedirectStandardOutput = True<br />
ps1.StartInfo.RedirectStandardInput = True<br />
ps1.Start()<br />
<br />
Dim s1 As String<br />
<br />
Dim sIn As StreamWriter = ps1.StandardInput<br />
Dim sOut As StreamReader = ps1.StandardOutput<br />
sIn.AutoFlush = True<br />
sIn.Write("dir/p" & System.Environment.NewLine)<br />
<br />
Thread.Sleep(100)<br />
s1 = sOut.ReadLine<br />
ps1.Kill()<br />
<br />
ListBox.Items.Clear()<br />
<br />
'// *** Display every return line *** //<br />
While s1 <> "End of Line"<br />
ListBox.Items.Add(s1)<br />
s1 = sOut.ReadLine<br />
End While<br />
<br />
ListBox.Items.Add(s1)<br />
However, if the process does not stop then the ListBox can not update data (I think because the process takes more priority then the ListBox?)
1. Can we modify the above codes so that we can update the ListBox without waiting the process completed?
2. If it is not possible ... is there another way to do it?
Thanks for any help!
|
|
|
|
|
ATC wrote: Thread.Sleep(100)
s1 = sOut.ReadLine
ps1.Kill()
I love how you wait one tenth of a second, read a single line of it's output, and then kill the process, whether it's doing something or not. Then you continue and try and read lines from a process you already killed off. You cannot do that. The process object must stay running in order for you to read from it's output stream.
ATC wrote: However, if the process does not stop then the ListBox can not update data
This is because the UI thread is running the code to read the output stream from the process. Until the read operation and filling of the ListBox is done and your code goes idle again, you're controls cannot repaint themselves because the thread is busy doing other things.
ATC wrote: I think because the process takes more priority then the ListBox?)
Priority has nothing to do with it. Threading does.
ATC wrote: 1. Can we modify the above codes so that we can update the ListBox without waiting the process completed?
You cant read hasn't has been output, so no. You have to wait for the process to finish. If by this statement you mean that you want the control to repaint itself and continue to fill the ListBox with data, you either have to move the code that reads the output stream to another thread, or you have to read the output stream asynchronously.
|
|
|
|
|
Hi Dave
Now I undestand more about my problem. I will try to do as you mentioned
Many thanks
|
|
|
|
|
Would background workers fit in this solution? If not, why?
|
|
|
|
|
Sure. BackgroundWorker is just a wrapper for a pool thread. It'll do the job just as easily.
|
|
|
|