|
|
...and I can read the file just fine. I can load it into my main app easily. I just cannot figure out how to get that assembly to load into a new domainapp.
|
|
|
|
|
Post the code for your Class Library project and for you SEPERATE (important!!) project that creates the app domain. Every character of both projects. There's something you're not showing me or what you're telling me doesn't match what the code is saying.
|
|
|
|
|
OK, thanks for your patience and help.
The project code that creates the separate dll:
Namespace Indicators
Public Class Indicator
Inherits MarshalByRefObject
Public Function Calculate()
Return 99
End Function
End Class
End Namespace
The project code that tries to read the .dll, excluding only the designer code.
(Right now however it won't run because I copied the code you supplied me but I don't know how to define the Indicator type)
Imports System.Reflection
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ad As AppDomain = AppDomain.CreateDomain("New Domain")
Dim as1 As Assembly = Reflection.Assembly.ReflectionOnlyLoadFrom("C:\ClassLibrary1.dll")
Console.WriteLine(as1.FullName)
Dim remoteCode As Indicator = DirectCast( _
ad.CreateInstanceAndUnwrap(as1.FullName, "ClassLibrary1.Indicators.Indicator"), _
Indicator)
End Sub
End Class
|
|
|
|
|
Oh heck, I think I did it. The problem I think was that I moved the .dll away from the project folder and it couldn't find a reference. I think I've done it -- many thanks to you and Luc.
|
|
|
|
|
That's cool. Even if it takes a few weeks, all it does take is perseverance.
|
|
|
|
|
I haven't done this myself, but a simple Google (load assembly in appdomain) gave many including this one[^].
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks Luc.
Yes there are hundreds of them, and over the past weeks I've downloaded dozens of sample projects. Although each one has helped me, none have allowed me to do what I need to do.
For instance, some say that you need MarshalByRefObject, others just use serialization, and others don't require either. Another problem is that most are written in C#... I'm not so familiar with that although I'm thinking I may have to learn it. There is much less using vb.net
This morning I thought I had it because I found a C# code that worked, and I just translated that to vb.net. But no...
I've been looking at these for weeks and I simply cannot crack this problem. I'm optimistic that Dave will help me get over the hurdle here.
MSFT doesn't provide good sample code for these methods.
chuck
|
|
|
|
|
Im developing a system using web developer 2005 express and sql server 2005 express
while i connecting to the database to login to the system i get this error "A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)"
This line is highlighted -> conMbr.Open()
Would anyone here explain to me please.Im just a beginner.
Help is very much appreciated.Thanks a lot in advance
My code would as:
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim conMbr As New SqlConnection
Dim cmdMbr As New SqlCommand
Dim sqlReader As SqlDataReader
Dim strVerifyMbr As String
conMbr = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\GpsCinema.mdf';Initial Catalog=GpsCinema;Persist Security Info=True;User ID=sa;Password=password;MultipleActiveResultSets=True;Connect Timeout=30;User Instance=False;Context Connection=False")
conMbr.Open()
strVerifyMbr = "SELECT MemberId FROM datMember WHERE MemberUsername=@txtUsername.text AND MemberPassword=@txtPwd.Text"
cmdMbr = New SqlCommand(strVerifyMbr, conMbr)
Dim checkUsr As String = ""
sqlReader = cmdMbr.ExecuteReader
While sqlReader.Read
If txtUsername.Text = Convert.ToString(sqlReader("MemberUsername")) And txtPwd.Text = Convert.ToString(sqlReader("MemberPassword")) Then
Response.Write("Login success")
Response.Redirect("Default.aspx")
End If
End While
End Sub
Life is up and down
Nevertheless,never give up hope and be confident to yourself
|
|
|
|
|
Is Google not working in Malaysia today?
A quick search on the web for that error message yielded the following article[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
I having a column named Steps which has more than five steps in it with line break now i want to read it line by line.
Example:
Steps has the following data in one field.
1.Type the valid URL in the address bar. 2.Enter the valid Username in the username textbox. 3.Enter the valid Password in the password textbox. 4.click log in button. 5.click ok button.
i need to read it as
1.Type the valid URL in the address bar.
2.Enter the valid Username in the username textbox.
3.Enter the valid Password in the password textbox.
4.click log in button.
5.click ok button.
Can anybody help me please very urgent...
kokila B
|
|
|
|
|
Replace the end of line (Environment.NewLine ) with a <br/>
|
|
|
|
|
Thanks for your immediate help..
Storing the data is not through Program its from another DB.
so i cant concenrate on insert part..
Kokila B
|
|
|
|
|
Ya I got the result
Dim a() As Char = {"" & Chr(10) & ""}
ds = bl.GetStepDS(record(0))
Dim strtest As String = Nothing
strtest = ds.Tables(0).Rows(0).Item(0).ToString()
Dim strarray() As String = strtest.Split(a)
You will get each line in array strarray.
Thanks,
Kokila
|
|
|
|
|
Hi
Please advise me on below.what is wrong with the code.
i want to check where the supplier is available or not
based on the name,country,currency
Inside my table if i add the supplier for 3 different
currency then 3 rows with same supplier ID is inserted.
<br />
<br />
For co = 0 To LstCurr.Items.Count - 1<br />
If LstCurr.Items(co).Selected Then<br />
strSql = "select supplier_name,country_name,currency from supplier_mst,country_mst where supplier_mst.country_id=country_mst.country_id and supplier_name = '" & Trim(TxtSupplierName.Text) & "' and country_name='" & Trim(DpCountry.SelectedItem.Text) & "' and currency='" & Trim(LstCurr.Items(co).Text) & "' "<br />
command.CommandText = strSql<br />
command.Connection = connection<br />
dataReader = command.ExecuteReader<br />
End If<br />
Next<br />
While (dataReader.Read())<br />
Supplier = True<br />
End While<br />
Catch ex As Exception<br />
Finally<br />
dataReader.Close()<br />
connection.Close()<br />
End Try<br />
|
|
|
|
|
soniasan wrote: Please advise me on below.what is wrong with the code.
What is the error you get?
soniasan wrote: strSql = "select supplier_name,country_name,currency from supplier_mst,country_mst where supplier_mst.country_id=country_mst.country_id and supplier_name = '" & Trim(TxtSupplierName.Text) & "' and country_name='" & Trim(DpCountry.SelectedItem.Text) & "' and currency='" & Trim(LstCurr.Items(co).Text) & "' "
Uugghh!!! You should really learn about SQL Injection Attacks. Please read SQL Injection Attacks and Tips on How to Prevent Them[^] It will make your SQL easier to read also.
soniasan wrote: While (dataReader.Read())
Supplier = True
End While
This is a bit pointless - For every row Supplier is set to true. And that is all you do. So long as at least one row is returned Supplier is set to true. Why read all the rows if this is all you do?
|
|
|
|
|
i want to import excel sheet on a form?
poonam
|
|
|
|
|
poonams wrote: i want to import excel sheet on a form?
You may wish to rephrase that. It looks like you are asking if we know what you want to do. As we are not mind readers we can't tell you what you want or not. Did you mean "How do I import an excel sheet on a form?"
|
|
|
|
|
Hi,
I am using .NET 2003.
During opening Microsoft Visual SourceSafe Project in .NET 2003
System is showing following message.
"The source control bindings for project BACKOFFICE differ from those stored in the solution file. Both sets of bindings must be the same.
Which bindings would you like to use?"
It also provide Check Box with caption as "Apply to all Projects"
And providing Four Button as per following.
a) "Solution's Bindings"
b) "Project's Bindings"
c) Don't Change Anything
d) Help.
This problem is not related to .NET 2003, it may be related to "Visual SourceSafe Project" setting.
So what I need to take care to resolve this issue.
Thanks & Regards,
KETAN
Ketan K.
|
|
|
|
|
I don't use VSS, so my knowledge is very limited.
But, these[^] might help.
|
|
|
|
|
Problem was get resolve by doing following avtivity.
I Checked "Apply to all Projects" and click on "Solution's Bindings" button.
System ask me for Check Out of Solution File.
I Check Out & Check In Solution File.
Same Message did not get repeat another time.
Regards & Thanks <n> Ketan K.
|
|
|
|
|
Hi
I am working on a application which has many different forms (not MDI)... designed in VB2005 Express
I am a bit confused about the way form_activate is called
My observations and issues are
After “Ok” click of message box, form_activate is called
On form show (if it was hidden) form_activate is not called
I want to put some code which is called whenever the form is shown/activated. Where should i put it.
Regards
Nshkarsh
|
|
|
|
|
Hi,
With reference to your query I would like to explain the sequence of Form based events:
INITIALIZE:
This event fires only when an application first creates an instance of a form. In an application with a startup form, the first event that occurs is the startup form's Initialize event. Initialize may also be called well in advance of a Load or Show if, for example, the following statement is executed:
Set x = New Form1
In addition, Initialize is called again if all of the references to the form have been previously set to Nothing and the form is then loaded, shown or has a variable set to it
(for example, Set x = New Form1).
Many of the tasks previously done in the Form_Load statement can, in Visual Basic 4.0, be performed in the Form_Initialize statement. Any statement that needs to be performed a single time when a form is created can be done here. Be careful that you do not reference any of the properties of the controls on the form because doing so will cause an automatic Form_Load.
LOAD:
The Form_Load event fires when a form is first loaded into memory. A form can be caused to load by an explicit Load statement, by calling a Show method when the form is not already loaded, or by a line of code in another module making a reference to any of the unloaded form's properties (or to any properties of the unloaded form's children).
For example, if Form2 is not loaded, and a subroutine in Form1 executes a line of code setting or reading Form2's Caption property, then Form2 will be loaded into memory, and the corresponding Form2_Load event will be called. Unless a form is loaded as a result of a Show method or has its Visible property set to True, the form will be loaded into memory but will not be made visible. Forms can be hidden and shown (using the Hide and Show methods) while remaining in memory; the Load event will only be fired when the form is first loaded.
Some procedures and methods of controls (for example, the SetFocus method) require that their parent form be loaded before they are called. In this situation, the best thing to do is to perform an explicit Form.Show in the Form_Load event, and do any such initialization after calling the Show method. This is preferable to doing the initialization in, for example, the Form_Activate event because Activate is called every time the user switches between forms in an application. Also, if you are calling related events, such as Activate, Paint, or Resize, be careful that their actions do not conflict with the Load and that they don't fire recursive events.
ACTIVATE:
As was stated previously, the Activate event is called every time a form becomes the active window, as long as the focus has moved between forms in the application. The Activate event is not called if the previous window that had the focus was outside of the application.
There are fewer caveats with Activate than with the previous two event procedures, perhaps because Activate is marginally less important than the Initialize and Load events. Code that needs to be executed every time the focus changes within an application should reside in the form's activate event.
I hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
My issue is :
I have a application with more the one windows forms
At one stage in the application i am showing 2 forms, say “Form 1” and “Form 2”..
"Form 2" is called by "Form 1" and "Form 1" is still shown in the back (Not hidden). Now i do some updates in “form 2”, close “form 2” and show “Form 1” back...
On Activate of “Form 1” i was making some buttons disable depending on if “form 2” is shown or not... Hoping that when i come back from “Form 2” activate will be called.. But it is not working..
I even tried calling "form 1's" activate form "form 2's" closed and dispose but no luck...
I can not close "form 1" so i tried with by hiding and showing "form 1" in the function where i am coming back to "form 1", but it dose not worked either
If i take the focus out of “Form 1” and come back it work... as then form activate works..
Can you plz help me
|
|
|
|
|
All of this sounds like your Form1 is showing Form2, waiting for the user to do stuff on Form2, then closing it and returning to Form1. Why not just show Form2 by calling ShowDialog instead of Show ??
|
|
|
|