|
Hi all,
I am doing a utility about checking network. I want to set a timeout for it. I mean that if timeout = t, after that time the function of checking network will be stopped. I tried with the Timer control but it failed. I am thinking about multithreading...
Can you help me. Thank you in advanced.
Thanh )
|
|
|
|
|
That depends on how you are "checking the network". So what are you doing and what's the code look like that you're using to do this?
|
|
|
|
|
hi
to all
i am using sqlbase as backend.
i want to develop a webform
i have a textbox , button, and a datagrid in it
in datagrid i have a template column in which i have kept a image control in the itemplate.
i have created a table called movies in my database.
it has mid,mname and murl as columns
mid has a id,
mname has the movie name,
murl consists of the url's of the mname's.
now when type in the mname in the text box. i am gettin the mid and mname in the grid columns. bu not the pics. how to retrieve them.
my code is something like this
coding
---------
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim dsOB As New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sConnect As String = "provider=SQLBASEOLEDB.1;Persist Security Info=False;User ID=SYSADM;Data Source=LOGIN;Password= HYPER"
Dim dr As DataRow
Dim con As New OleDbConnection
Dim cmd As New OleDbCommand
con.ConnectionString = sConnect
cmd.Connection = con
con.Open()
Dim sSelectOB As String = "select mid,mname from movies where mname like '%" & TextBox1.Text & "%' "
Dim daOB As New OleDbDataAdapter(sSelectOB, sConnect)
'Dim dsOB As New DataSet
daOB.Fill(dsOB,"movies")
Dim str As String
'TextBox1.Text = dsOB.Tables(0).Rows(0).Item(2)
'gridbind()
'Image1.ImageUrl = dsOB.Tables(0).Rows(0).Item(2)
'Image1.ImageUrl =
' bind()
DataGrid1.DataSource = dsOB
DataGrid1.BackImageUrl = dsOB.Tables(0).Rows(0).Item(1)
DataGrid1.DataBind()
'DataGrid1.Items.Item(2)
'DataGrid1.DataKeys.Item(2)
'Response.Pics(dsOB.Tables(0).Rows(0).Item(2))
'Image1.Visible = True
con.Close()
End Sub
Sub bind()
End Sub
Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged
'If sender = dsOB.Tables(0).Rows(0).Item(2) Then
' e.Item.Cells(0).Controls(1).Visible = True
'End If
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
End Sub
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
Dim image1 As System.Web.UI.WebControls.Image
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
image1 = CType(e.Item.Cells(0).Controls(1), System.Web.UI.WebControls.Image)
image1.ImageUrl = e.Item.Cells(0).Text
End If
End Sub
End Class
i know that this code is incomplete.
but i will be glad if any one can help mew out in this.
thanks in advance
No End No Begining
|
|
|
|
|
Hi all i have this code, and i want to pass parameters to the function
being executed by the thread
Dim t1 As Thread = New Thread(AddressOf execute)
Dim t2 As Thread = New Thread(AddressOf execute)
t1.Start(1)
t2.Start(1)
sub execute(ByVal num as integer)
''Statements
''
end sub
Regards
|
|
|
|
|
The parameter is sent as the type Object.
Sub execute(num as Object)
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks a Lot it did work.
I have another question how can i keep a thread wait untill the other one finishes. Say i have
Dim t1 As Thread = New Thread(AddressOf execute)
Dim t2 As Thread = New Thread(AddressOf execute)
t1.start(0)
t2.start(1)
But t2 should not start untill t1 finishes. I have to create say varying threads right now i and only creating two threads but i have to actually create as many as there are records in the database. but at the same they won't be more then 5, but could be less even one. At end of the program(thread) i am updating records in the database and that is the reason i dont want to start the next thread before the finish of the first.
Regards
|
|
|
|
|
Use the Join method in the Thread class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks! for the reply
I am doing that but it requires time period, and in my case the time period will not be fixed, or it won't be a good idea to hardcode the time. is there any other way u can suggest.
Regards
|
|
|
|
|
sabby2006 wrote: I am doing that but it requires time period
No, it doesn't. You can specify a time period as timeout limit, but that is not required.
---
single minded; short sighted; long gone;
|
|
|
|
|
In 1.1 I didn't think paramiters could be passed to a sub called on a new thread. I believe you have to store the data in class level variables accessible to the sub. Not positive of this though.
|
|
|
|
|
Iam new to VB.Net2005.
In the Form Load Event Iam Displaying Data into Datagridviewand I have written a code for Double-click event which is going to disply the data in the relevent textboxes from datagridview.
After Displaying I want to modify the Data and updating it into the Database.
For this I have written the code as:
ds.Tables("emp_details").Rows(n).Item(1) = txtsurname.Text ds.Tables("emp_details").Rows(n).Item(2) = txtname.Text
ds.Tables("emp_details").Rows(n).Item(3) = txtdesg.Text
ds.Tables("emp_details").Rows(n).Item(4) = txtplace.Text
ds.Tables("emp_details").Rows(n).Item(5) = txteligamt.Text
ds.Tables("emp_details").Rows(n).Item(6) = txtfno.Text
ds.Tables("emp_details").Rows(n).Item(7) = txtyear.Text
da.Update(ds.Tables("emp_details"))
But Iam getting the error as :
"Update requires a valid updatecommand when passed Datarow collection with modified rows".
Please suggest me correct code for this updation urgently
ThanX in advance
|
|
|
|
|
|
That is DataAdapter.Update
|
|
|
|
|
|
You're looking for the CommandBuilder class for the database you're using. If you have an Access database, then you'd be using the OleDbCommandBuilder[^]. If SQL Server, SqlCommandBuilder[^].
These classes take the Select command that you gave to your dataadapter and build the other three corresponding SQL commands, DELETE, INSERT, and UPDATE, for you. It will only work with single table Select commands though.
|
|
|
|
|
Hi Dave Kreskowiak,
In ur Previous Reply , u told , one must know the following things
1.low-level file system extension
2.writing a database manager to hold all of the passwords
3.writing a utility to manage the password database
4.and finally, comming up with a method to recover a file if the user ever forgets the password
5.This requires a blackbelt in Windows internals and NTFS
to implement the file folder security by applying the password.
So from where should i start , out of the above points?
I really don't want any code.
I Just want u to guide me.
Thank You
|
|
|
|
|
From your previous posts, you don't have to skill level to pull this off.
You've got about 3, 1000+ page books to read just to understand device driver developement and the ins-n-outs of NTFS.
For a comparison of whats involved, you're a student walking in to his first metal shop class, wanting to build a brand new car. You are a couple of years away from aquiring the programming skill to do this.
|
|
|
|
|
I'm trying to find out how I can open and read an Outlook .pst file. I need to be able to read/edit all of the email headers. If the attachments have any header type information that tie them to a particular mail server, I need to be able to read/edit that info too.
Can someone point me in the right direction. I'm using VS2005. Are there any code samples anywhere or articles that tell how to do this type of thing? What is the best way to perform these tasks?
Thanks.
|
|
|
|
|
You'll have to use automation to get Outlook to read the PST file for you. The file format is protected by Microsoft and there is just about no documentation on the web on it.
|
|
|
|
|
hi,
Have u got any idea on reading the pst file path of current user.i tried through registry.But its not working.
If u have any idea nor samples,pls share with me
Thanks
|
|
|
|
|
That depends on how the object was written and what it does with that FileNum. Most likely, no, you can't redirect it.
You'd have to let the object save it's files, then transfer the file to the client and have it load the file when done.
|
|
|
|
|
Wow - really terrible database design. Is your class assignment saying it has to look like that ? How do you think you could do it ? I mean, do you have any ideas ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
If I didn't know better, I'd say you were talking to yourself.
|
|
|
|
|
I'm new to programming, I want to build application that play dvd movies, please help me to do this. i will be highly gratefull.
|
|
|
|
|
Drag the Windows Media Player control onto a form. You're done. Of course, the MPEG2 codecs need to be installed on the machine, but that's another story.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|