|
When you say "load the assembly" do you mean like [DllImport]? If so, I am currently trying to use DllImport and it finds the DLL, however, it says it can't find the entry point in the DLL, and I've made the function I'm importing the same name as the method in the DLL so I thought it would find it and it doesn't, so then I tried to specify the entry point by doing
[DllImport("myDll.dll", Entrypoint="myMethod")] public static extern void myMethod()
and it still can't find the "entry point" when I run the method in the code later? Do I have to specify something within the DLL?
Thanks for the help,
Taicho
|
|
|
|
|
Taicho2k wrote: I have a solution that contains 2 projects one is the executable and the other is a DLL that I wrote that the application uses... the problem is that method I am using from the dll tries to reference a class and/or method from the application but since it isn't referenced I get an error here is the code:
Ok, I'm not clear on what you're trying to do, but it sounds like you have a circular reference. You have an executable that uses an assembly and an assembly that tries to use the executable. Correct? The solution lies in breaking the circular reference.
|
|
|
|
|
I am trying to add some key down events to a form. It works great until I add a radiobutton to the form, at which point it focuses on the radiobutton and ignores all the keyboard commands. Any ideas on how to make the keys affect the form instead of the radiobutton?
Thanks,
Matt
|
|
|
|
|
|
Thanks for the help,
It works now for all of the keys except the arrow keys and tab key. Is there any way to have it run the keydown function when the arrow keys are pressed instead of jumping between the radiobuttons?
Matt
|
|
|
|
|
Sure, read up on ProcessCmdKey and IsInputKey
|
|
|
|
|
Hi, I'm trying to bind a lookup table to a comboBox. Well the contents of the ComboBox binds ok, but the binding on the SelectedValue doesn't work! Here's my code:
DataTable table = new DataTable();<br />
table.Columns.Add("Name", typeof(string));<br />
table.Columns.Add("Value", typeof(int));<br />
for(int i = 0; i < namesArray.Length; ++i)<br />
{<br />
table.Rows.Add(new object[] {namesArray[i], i});<br />
}<br />
<br />
combo.DataSource = table;<br />
combo.DisplayMember = "Name";<br />
combo.ValueMember = "Value";<br />
<br />
combo.DataBindings.Add("SelectedValue", dataset.LoadModule, "MyColumn");<br />
<br />
numericUpDown1.DataBindings.Add("Value", dataset.LoadModule, "MyColumn");
What am I missing? This is going to drive me nuts!!!
|
|
|
|
|
I am thinking that you may have a sorting problem. Do you have the combo box sort set to accending or decending. If so I think that is your problem. Try the following after adding all the rows...
table.DefaultView.Sort = "Name";
combo.DataSource = table.DefaultView;
Chris
|
|
|
|
|
Also make sure you set the sort on the combobox to none.
|
|
|
|
|
If that doesn't work then try combo.DataBindings.Add("SelectedValue", table /*or dataset.Tables["MyTableName"]*/, "Value");
|
|
|
|
|
Thank you for the help! Now the right item is selected, but when I change it, it doesn't change the data source!
For example:
private void myCombo_SelectedValueChanged(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show(dataset.LoadModule[cm.Position].MyColumn.ToString());<br />
}
In this code above, the MessageBox always displays '5', which is the initial SelectedValue.
I'm really having a hard time with this!
|
|
|
|
|
I dont have much experience with a currency manager. I am guessing the same datatable isn't getting bound to the currency manager. How are you binding the code to the currency manager?
|
|
|
|
|
I use the CurrencyManager because its Position property represents the index of the current record being viewed. FYI this is how I use it and it works fine:
cm = BindingContext[dataset.LoadModule] as CurrencyManager;<br />
dataset.LoadModule.DefaultView.Sort = "SerialNumber";<br />
cm.Position = dataset.LoadModule.DefaultView.Find(serialNumber);
But this is not a CurrencyManager issue, since the program gives me the right value (5), it just doesn't update it!
|
|
|
|
|
AFAIK there is no ComboBox.SelectedValue
did you mean SelectedText ?
|
|
|
|
|
This should be pretty easy but I'm having so many problems with it.
I'm following someone elses code and cant figure out how he did this.
One of the webmethods returns 3 parameters and it uses a class of somesort to do it. We had to reverse engineer to get the code so its not complete.
[WebMethod]
Public Class1 HelloWorld(int i1, string str1, string str2)
{
try
}
//Code
}
Catch
}
return Class1(1,2,3)
}
{
return Class1(0,0,0)
}
}
How is this possible? Thanks in advance.
|
|
|
|
|
why would it not be possible ? Importing a web service will import the types it exposes, including enums and classes.
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 )
|
|
|
|
|
I'm sorry I guess I wasnt clear. I get this error when i try to build.
'Service.Test222(string, string, string)' is a 'method' but is used like a 'type'
|
|
|
|
|
Oh, OK. The code looks wrong to me, shouldn't say return *new* Class1(x,y,z); ?
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 )
|
|
|
|
|
It looks as though it's one of two options. Either the Class1 mentioned in the catch/finally block refers to a method on the web service which returns an instance of Class1, or you are missing a new statement on the return Class1 constructor.
|
|
|
|
|
I guess my real question is how to make class1 work as a type. When i put class1 in front of Hello world I get an error. How do i declare/create it so I can use that class1 type
|
|
|
|
|
It should exist as webserviceNamespace.class1. Can you see it declared in the code created when you import the webservice ?
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 )
|
|
|
|
|
You are getting me closer. Again I appreciate it. Here is my exact code(I've simplified it). If i want to return those three arguments what do i have to do?
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Class1 : System.Web.Services.WebService
{ }
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public Class1 Hello() {
return new Class1("1","2","3");
}
}
|
|
|
|
|
You are close, now you need to provide an overloaded constructor for Class1 to take your 3 string arguements. It would look something like this:
public class Class1 : WebService
{
public Class1(string one, string two, string three)
{
this.one = one;
this.two = two;
this.three = three;
}
public Class1 Hello()
{
return new Class("1", "2", "3");
}
}
|
|
|
|
|
when i run that (see the code below) I get this error. Class1 cannot be serialized because it does not have a parameterless constructor.
public class Class1 : System.Web.Services.WebService
{
public Class1(string strOne, string strTwo)
{
strOne = strOne;
strTwo = strTwo;
}
[WebMethod]
public Class1 HelloWorld(string str1, string str2)
{
return new Class1(str1,str2);
}
}
|
|
|
|
|
brsecu wrote: when i run that (see the code below) I get this error. Class1 cannot be serialized because it does not have a parameterless constructor.
Just add a default constructor as well that has no parameters:
public class Class1 : WebService
{
public Class1(){}
public Class1(string s1, string s2, string s3)
{
}
}
|
|
|
|