|
Hi everyone -
I'm really near to getting insane. I have a .Net Remote Application. My ServerObject listen at a special Port.
Each Client can call a function "login" to register itself at the server.
Servercode:
Public Sub _login(ByRef client As IClient) Implements IServer._login
If (Me._clients.ContainsKey(client._guid)) Then
Me._logout(client)
End If
Me._clients.Add(client._guid, client)
End Sub
_clients is a Hashtable !!!
Clientcode:
Public Function _connect(ByVal ipAddress As String, ByVal port As String) As Boolean Implements IClient._connect
Dim result As Boolean
Dim myThread As Thread
myChannel = New TcpChannel(0)
ChannelServices.RegisterChannel(myChannel)
remServer = CType(Activator.GetObject(GetType(IServer), "tcp://" + ipAddress.Trim() + ":" + port.Trim() + "/control.rem"), IServer)
Do While Not result
Try
remServer._login(Me)
result = True
Catch e As Exception
result = False
myThread = Thread.CurrentThread
myThread.Sleep(1000)
End Try
Loop
Return result
End Function
Actually, everything works fine. But after a time, when i do nothing at all, the hashtable is just empty, although the client is still up.
I also tried to set the lifetime of the server-object to infinite, but somehow it did not worked.
can someone please help me out of my mess?
if you need more code, just let me know.
thanks to all!
tom
|
|
|
|
|
You probably created a new server object each time and the hashtable _clients is not a shared variable. Each time you call remServer._login, you are using a new server object (and hence a new hashtable).
First, you need to make the _clients a shared (static) variable.
Then, modify your _login code as follows to provide thread safety:
Public Sub _login(ByRef client As IClient) Implements IServer._login
SyncLock Me._clients
If (Me._clients.ContainsKey(client._guid)) Then
Me._logout(client)
Else
Me._clients.Add(client._guid, client)
End If
End SyncLock
End Sub
Good luck.
My articles and software tools
|
|
|
|
|
i tried this out but it didn't work.
i found out, that, if i run a thread, that always calls a function on my remote objects every 1 second, everything works fine.
so my guess is, that the remote objects are destroyed after a time, when they are not used.
i also tried to change the lease-time of my objects, but i don't know how to set the lifetime of an MarshalByRef Object to infinite ... any idea?
|
|
|
|
|
Is it possible to run an application from within another application?
My current application:
The user selects an image from a thumbnail list that is displayed in a ListView. The full image is then displayed in a PictureBox.
What I would like to do:
When the user selects a thumbnail image I would like the larger image to open in an image viewer such as VuePrint Pro.
The tricky part is that I want VuePrint Pro to open within my application and in the same “foot print” as the PictureBox so that I can still have control of it from within my application.
Thanks
Brad
|
|
|
|
|
Brad Fackrell wrote:
The tricky part is that I want VuePrint Pro to open within my application and in the same “foot print” as the PictureBox so that I can still have control of it from within my application.
You can launch the external application, but you can't tell it where to render itself. Your application cal only have control like that if your external application comes with a COM library, like Word or Excel does, that exposes the functionality of the app through a control, like an ActiveX control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
you can't tell it where to render itself
...that is what I was afraid of.
I did a little digging and found the Kodak Image controls in the COM library. Have you had any experience with that?...good or bad??
Thanks
Brad
|
|
|
|
|
I haven't used them myself, but I've seen mixed reviews running around on the VB sites. Some people have success with them, some don't. But, in the cases where there wasn't any success, I have to question the abilities of the programmer, their image manipulation goals, and what they expect of out the Kodak components.
I haven't come acrossed any documentation for them either, but, then again, I wasn't looking for it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks.
I'm searching for more info about them right now.
Brad
|
|
|
|
|
what if you want different table styles pointing to the same table. The app that I am working on is one that is used to correct tests. There is more than one type of error. Right now I have all the data being retrieved and thrown into the same table. I may have to change this is base the query on the correction mode and insert the data into different datatables, I really should do this, but I am still curious of the present problem.
I would like to create tablestyles, which I though that I did, so that in the different correction modes different columns are displayed, but I get an error when I try to do this:
<br />
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll<br />
<br />
Additional information: The data grid table styles collection already contains a table style with the same mapping name.<br />
Now they are the same mapping name, because the mapping name is the name of the table right?
Thanks for the help
|
|
|
|
|
hey kowplunk, sorry about the delay in my response, i was out of town for a few days.
anyways, the cleaner way to handle it would be to have the different data loaded into different tables and have the appropriate tablestyle handle the appropriate table. however, i can't say for sure that this is the case as i have no idea what the table structure looks like, what the resulting data looks like etc.
i guess if you have the same data but you want to display it in different ways you could just load everything into the same table, then when you need to change the way the data is displayed, release the mapping name of the current tablestyle (via code) and then set the mapping name of the secondary one. as you found out you can't have two tablestyles pointing to the same table at the same time.
however, if you're intention is to show different columns etc. at different points, i think you might be better off with the multiple table solution.
-jim
|
|
|
|
|
Thanks for the help. Actually the error message was pretty descriptive. In the different styles that I had there was column mapping names that were the same and it doesn't like that, but it is easy to change. Everything is working awesome now. Thanks again.
|
|
|
|
|
I have to read a .xsd schema file by using visual basic code.Vb.net is not necessary.The code mst be in Visual basic.Give me idea.
|
|
|
|
|
Im developing a snap-in ( VB6 snap-in designer )
I want to develop a ResultView as 1 in the :
Administrative Tools -> Computer Management's
SystemTools->System Information->System Summary
I dont know how to display this kind of a view
plz help me out.
raheela
|
|
|
|
|
Hi Friends,
I want to keep the width of the text on all the tab pages as constant.
The tab pages can have diferent text but all tabs should be properly alligned one below the other.I have 9 tabs so I want to arrange 3 tabs each in 3 rows
exactly alligned.
ALOK
|
|
|
|
|
I would like to get info from my DB that im dont with but now i want to get info that is between do specified dates for exampel: info between 2004-06-25 to 2004-07-15
In my DB i do log the dates.
This is my code i use now:
Private Sub DataGridUpdatePrint()
Dim dbconn, sql, dbcomm
Dim dbread As SqlDataReader
Try
SqlPrintConn.Open()
dbread = SqlPrintCom.ExecuteReader()
If dbread.HasRows() Then
OrderPrintRepeater.DataSource = dbread
OrderPrintRepeater.DataBind()
End If
Finally
dbread.Close()
SqlPrintConn.Close()
End Try
End Sub
Thanks to that person that can help me...
/ Timmie
|
|
|
|
|
You didn't post the most important part of your code. What does the SQL statement look like? This is where your going to put your WHERE clause with your date information.
SELECT fields FROM tableName WHERE datefield BETWEEN @date1 AND @date2
Your @date1 and @date2 should be parameters in your SQL command and have corresponding SqlParameter objects created and filled. In your case, something like this:
dbcomm.Parameters.Add("@date1", SqlDbType.DateTime).Value = firstdate
dbcomm.Parameters.Add("@date2", SqlDbType.DateTime).Value = seconddate
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Any body master in Datagrid please Help me...
Datagrid Problem
Hello can any body help
I have a grid which contains textboxes in it, Can any body help as how to add a new row of blank text boxes within the grid when a button is clicked
Thanks in Advance
Irsh
|
|
|
|
|
Hi..
I assume that your datagrid has a datasource / datamember one table from a dataset.
if you add a new row to your table then the grid will show the new row as empty textboxes
example
'we asume that you have already a dataset ( named dataset1 ) and in the dataset is a table ( named table1 ).
private sub addrow
Dim newrow As DataRow
newrow = DataSet1.Tables("table1").NewRow
DataSet1.Tables("table1").Rows.Add(newrow)
end sub
this sub adds a row to your table and this row must be shown in the binded datagrid as empty textboxes.
Hope i helped you.
Ramaseb.
|
|
|
|
|
Any body master in Datagrid please Help me...
Datagrid Problem
Hello can any body help
I have a grid which contains textboxes in it, Can any body help as how to add a new row of
blank text boxes within the grid when a button is clicked
Thanks in Advance
Irsh
|
|
|
|
|
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the notes folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderNotes)
Set objNoteItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objNoteItem.Move objMAPIFolder
objNoteItem.Save
objNoteItem.Display 1
|
|
|
|
|
hii every one,
i need to convert from the doc file to html..not by using save as in the ms word.. coz it makes problems with the arabic laguage...it will be helpful if i know the structure of the doc file...
any one can help ??
|
|
|
|
|
|
You'll have a difficult time with this one. Your talking about writing an app that can load a .DOC file, the file structure of which is not simple nor easy to interpret, rendering it in a form that you can then go over and convert to HTML and images. This will be FAR from easy and I don't think there is alot of experience out there to help you. You might want to check out the Open Source sites, like SourceForge, and search for a Word document viewer to get you started. I don't know of any projects myself, but that doen't mean they don't exist.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a data sheet from rtf file that I read into the excel table so that it looks need. I also have a limit as to the range of these values. Eg. 3 to 7. So if the value in the cell is 9, it is out of range and I am suppose to highlight it in red colour. Any help on this ? I am using Visual Basic, not VBA.
On another question, is there any good Visual Basic example of how to draw a chart without having the program crash during the second time? Thanks in advance.
|
|
|
|
|
I want to return a value from textbox to other form when it opens, how to code the return?
my code:
In FORM1:
file_location = textbox1.text
Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
Dim view As New frmView
MessageBox.Show(file_location)
If view.ShowDialog() = DialogResult.OK Then
End If
End Sub
Public Property ReturnView() As String
Get
Return file_location
End Get
Set(ByVal Value As String)
file_location = Value
End Set
End Property
In FORM2:
Dim AddJob As New frmAddJob
view = AddJob.ReturnView
TextBox1.Text = view
The problem is the view is nothing..it can't pass the value to form2..
does everybody know what's wrong with code? Thanks for your help..
-----------------------Lisa--------------------------
|
|
|
|