|
i want to develop a win application by vb.net which runs in background.pls give me with a sample code.
tbhattacharjee
|
|
|
|
|
|
please tell me how to write a code in such a way that a function will be called
after every 5 minutes by thread?.pls give help with a sample code for
vb.net.
tbhattacharjee
|
|
|
|
|
put a timer control on your form and then set the interval to 5 mins( remember it takes in put in milli seconds) 5*1000 * 60 = 300000
no in timer event put the code which you need to use like
' code inside timer control
Dim t As New Thread(AddressOf Test)
t.Start()
' put this on top of the form
Imports System.Threading
'put this after timer event
private sub Test()
msgbox "Thread Executed"
end sub
|
|
|
|
|
If you use the System.Timers.Timer component, every time it fires the timer_elapsed event, it executes on a different thread.
Steve
|
|
|
|
|
yes it will run on new thread. so what exactly you need. if the previous thread is already running then what you want with that. if you want to dispose that and re-run the same thread then make the thread global on the form or application depending on the requirement and use t.dispose to close the previous thread.
|
|
|
|
|
Hi, i am new to ado.net so soory, if it seems like a stupid question.
I have filled a datatable with data by a simple query.
i have a datagrid, which doesn't need to show all the columns of the table,
how can i show only some of the columns without needing to query again?
can a dataview show parts of the datatable i have?
thanks,
Nir.
|
|
|
|
|
Hi Nir,
look into the tablestyles and columnstyles properties of the datagrid. you basically create a tablestyle with a mappingname = your datatable.name property and a columnstyle for each column that you wish to display with a mappingname = your datacolumn.columnname property. this can be done at design time through the designer or through code, whichever is easier for you. find docs on tablestyles here, and here's an article describing how to accomplish exactly what you're looking to do.
good luck.
-jim
|
|
|
|
|
Thanks for your help, it worked.
|
|
|
|
|
Hello Nir!
Try out this statement b4 binding the datatable with datagrid..
If dt is the datatable
dt.Columns("ColName").Dispose() <----
_mubashir
|
|
|
|
|
Thanks for your help, i managed to create the table style.
|
|
|
|
|
VS 2003
vb.net
Crystal Report 9
;P;P Now I am facing a big probelem.
I make a project I want to put the project in another system
that is windows 98.But the problem is not working the exe generate a
exception the message (processid =oXfffcblal (-216671),Thread
id = oXfffcc941). I have instaled Frame worke poperly.
In my project I have used Crystal Report com file name
(Crystal Report viewer Control 9) this is main reason. I have checked
in many ways I got a message beginnig the instalation.
unicows.dll is messing. The instalation is failed. Then I got
another message could not register the file .I introduce above my
setup package.How can solve this problem
Anybody help me please.
Continue...
-- modified at 8:12 Friday 26th August, 2005
|
|
|
|
|
did you included the Merge Module of Crystal 9 and put the CD Key in the license file before building the package ????
|
|
|
|
|
can someone help me with the ftp! i want to connect with the ftp through vb.net and download a textfile, edit it in vb.net and upload it back! Do i need to install any dll? Help me please!
|
|
|
|
|
|
I have built one function which creates one text file then work on it and then after processing on the file it deletes the file.
the problem is when I delete the file it gives error that the file is in use.
the code is
Dim txt As IO.File
Dim tmp As System.IO.FileStream
tmp = txt.Create("C:\abc.txt")
tmp.Close()
If txt.Exists("C:\abc.txt") = True Then
fl = txt.AppendText("C:\abc.txt")
fl.Write("testing")
fl.Close()
End If
fl=nothing
txt = Nothing
GC.WaitForPendingFinalizers()
GC.Collect()
'kill("C:\abc.txt")
' or
System.IO.File.Delete("C:\abc.txt")
' THIS DELETE LINE GIVES ERROR
THE ERROR IS
Message "The process cannot access the file "C:\ABC.TXT" because it is being used by another process."
|
|
|
|
|
Rizwan Bashir wrote:
tmp.Close()
You didn't call .Dispose() on the FileStream objects. Do that and you'll be all set.
Forget using the GC class for this. Just remove that code.
Dim txt As IO.File
Dim tmp As System.IO.FileStream
tmp = txt.Create("C:\abc.txt")
tmp.Close()
tmp.Dispose() ' Tells the FileStream object to release the underlying unmanaged file handle
If txt.Exists("C:\abc.txt") = True Then
fl = txt.AppendText("C:\abc.txt")
fl.Write("testing")
fl.Close()
fl.Dispose() ' Same thing...
End If
The next four lines are unneccessary
'fl=nothing
'txt = Nothing
'GC.WaitForPendingFinalizers()
'GC.Collect()
System.IO.File.Delete("C:\abc.txt")
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
there is nothing called Dispose in any of these variables
fl.dispose() ' not available
tmp.dispose() ' not available
txt.dispose() ' not available
there was only close option in fl.close() which I used.
|
|
|
|
|
Actually, you're right. My mistake. That's what I get for spending a day writing a couple of large Dispose implementations in a couple of my classes...
Ok, no Dispose. Close should do it, so what's the exception you're getting?
This works...
' Put this at the top of your code
Imports System.Io
' The first Dim is unneccessary...
' Dim txt As IO.File
' Condensed the next few lines...
Dim tmp As New StreamWriter("C:\abc.txt", FileMode.Create)
tmp.Close()
' The IF statement is unneccessary considering it will ALWAYS return true.
' Where is fl defined and how???
fl = File.AppendText("C:\abc.txt")
fl.WriteLine("testing")
fl.Close()
File.Delete("C:\abc.txt")
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks Dave. I put the text file in system temporary folder and now I can delete the file. I think I had the problem of security on the folder where I could not delete the file..
|
|
|
|
|
That was going to be my next question...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I see you found the problem,
Sorry dave, I didn't know you were still working on this..
progload
-- modified at 11:59 Friday 26th August, 2005
|
|
|
|
|
Hi,
is there anyway that I can list out all the Windows user and group using vb.NET?
thanks
|
|
|
|
|
Dim oDomain, Member As Object
oDomain = GetObject("WinNT://" & "MyDomainName")
For Each Member In oDomain
If Member.Class = "Group" Then
Console.Writeline(Member.Name)
End If
Next
|
|
|
|
|
Thanks. I'll give it a try
|
|
|
|