|
i am able to take the reference of that dll.
i am not able to rectify either the problem with the dll creation or taking ref.
i have a c#.net project .i am creaing the dll using this.
the procss i am following:
1)tlbexp (to create typelib)
tlbexp ComInteropExample.DLL /out:ComInteropExample.tlb
2)regasm
regasm ComInteropExample.DLL /tlb: ComInteropExample.tlb
after this i m taking the ref of the .tlb file in my vb project.
i am not able to call the function inside.
Plz help
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
Hi All,
If you have a control (such as a textbox) which is placed inside any type of panel that has it's AutoSize property set to true, and the AutoSizeMode set to grow and shrink,
then when you ErrorProvider.SetError on it, the panel does not grow and as a result, the error icon is clipped.
Does anyone know a solution to this? it's driving me up the wall!
Thanks
Jon
|
|
|
|
|
I'm Looking for a control similar to ListBox, but it would be a little different. You would see the options that you can choose from on one side (preferably left), and then you would see what you've selected in the list on the box on the right hand side of control. You would be able to move the items back and forth by double clicking on them, or clicking on arrows that would move them. I've seen this type of control used multiple times, and so I figure it must be in the .Net framework, but I can't think of what it's called to find it.
Thanks for the help.
|
|
|
|
|
No, it doesn't exist. This control, as you describe it, is made of 2 listboxes and 2 buttons, one for move left to right and one for move right to left.
You can of course create your own custom control and render in it 2 listboxes and 2 buttons.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
You could use the standard listbox control for this. Just create 2 list boxes, and place them side by side. have 2 buttons in the middle "->" and "<-". In the button mousedown control, check to see if something is selected in the list box. If there is, get the item in the list box, and add it to the other side. All the "magic" here is done by the buttons.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Erhm, I think that selecting kind of thing is a misterious kind of cooperation between controls, events and code! You can even try this at home!!
Right click your projects and choose Add > User Control
Drag two listboxes on the newly create control which you named whatever you want...
Place one listbox in the left, the other one aligns right, make sure to leave some space in between the boxes for some buttons...
name the left listbox lstOptions, the right listbox we name lstSelection...
Now place four buttons aboce eachother between those lists
name the first one btnAddAll
The second one btnAdd
the third one btnRemove
and the last one btnClearSelection
Now create a function which will add a listitem to a listbox
private void AddItem(ListItem Item, ListBox Box)
{
// Your code
}
then doubleclick the btnAddAll and enter the following code :
<br />
foreach (ListItem itm in lstOptions)<br />
{<br />
lstOptions.Items.Remove(itm);<br />
lstSelection.Items.Add(itm);<br />
}<br />
Then add quite similar code behind the other buttons... You've just create your own control!!!
|
|
|
|
|
I want to write a methode where i can deliver named parameter like this
<code>private void MethodeName( aVar = 10, bVar = "20", cVar = 30, <PropertyName> = <value>, ... ){}</code>
where aVar, bVar and cVar are properties of the class.
I saw know that at Attributes....and i hope there is a way to achieve this with normal methods. If not then i need to know how can i do something similar.
thx
|
|
|
|
|
Standard CLR languages do not support this, but nothing can stop you from
creating a new language and a compiler for it.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I don't think you can write that in C#. Attributes are a special case I suppose.
Why would you need such a method anyway?
MarkPhB wrote: where aVar, bVar and cVar are properties of the class.
Do you mean properties as in get-set or just fields. In the first case, you could just use the properties as they were designed to be used: myClass.aVar = 10, etc...It's a good practice in this case to capitalize the first letter of the property name. In the second case, you could encapsulate the field in a property get-set and use it as described in the first case.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Based on your example code, you are showing that you want to provide default values to the function parameters when you define the method. To do this you need to provide different overloads to the function.
Based on your explanation, you want to call a method and pass property initializers to it. You can do something close, but you will need to wait until the .NET Framework v3.5 is released (or use the Beta 2 release). The reason I say "close" is that you can only do this on object creation.
For example, if you have a class
public class UserProfile
{
public int UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
pubic UserProfile() { }
} You can create a new instance like this
UserProfile profile = new UserProfile
{
UserId = 123
FirstName = "John"
LastName = "Smith"
};
|
|
|
|
|
However you can create a method with an undefined number of arguments :
private void MyBike(string one, params object[] BikeParts)<br />
{<br />
foreach (Object BikePart in BikeParts)<br />
{<br />
}<br />
}
however you cannot assign names to them and they must be of the same type
|
|
|
|
|
This does not look like acceptable syntax. In C# you always should specify the parameter type in the declaration. C# does not support default parameters. If you intend your sample to mean a method call, private void are irrelevant qualifiers. I don't thing C# supports method calls with this syntax.
Rudolf Heijink
|
|
|
|
|
I'm trying to re-order items in a listbox using Drag-Drop. However, the mouse coordinates I get from the method arguments (e.DragEventArgs) are never right, and the indexFromPoint method is forever returning -1. I've tried to correct the mouse coordinates using PointToClient, they still seem to be incorrect however. Any help with this would be appreciated. Thanks a bunch!
|
|
|
|
|
Yes you would need PointToClient; you can verify the coordinates by looking at them,
e.g. with Console.WriteLine while running in debug mode. You can also get current
mouse position from Cursor.Position
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks for the pointers, I'll continue to poke at it with a large stick. Eventually it will cave.
|
|
|
|
|
hello ALL,
I have a doubt.
if i want to continue normally after catching the expecteed exception is it possible??
Ex:-
try
{
int intDivVal;
for (int i =o ;i<5;i++)
{
int Divval=10/i;
}
}
catch(dividebyzeroexception ex)
{
messagebox.show(ex.message.tostring());
}
i want to continue after showing the message.
Thanks in advance
Bharath.S Ron
|
|
|
|
|
yep your code there will carry right on.
If you continue you have to think about anything that might have broken during an exception though i.e. was something being set to a value or a stream being opened.
Carrying on can lead to losing data or more expcetions.
If you want to do something with the exception and then let the exception carry on then you can
catch(dividebyzeroexception ex)
{
messagebox.show(ex.message.tostring());
throw ex;
}
|
|
|
|
|
originSH wrote: catch(dividebyzeroexception ex)
{
messagebox.show(ex.message.tostring());
throw ex;
}
You actually want to just do a throw here rather than throw ex . The throw ex causes the original stack trace information to be lost while throw preserves it.
|
|
|
|
|
ahhh yeah "throw;" maps to rethrow doesn't it...
|
|
|
|
|
Yep. throw is rethrow in the IL.
|
|
|
|
|
hello
It will continue as you wrote it. Alternatively, you can use the finally statement to make sure some code is executed in all cases (try succeeded or catch executed)
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Yeah, I understand you want to continue your loop after the exception is thrown...
In your code the try & catch block contains the loop...
<br />
try<br />
{<br />
int intDivVal;<br />
for (int i =o ;i<5;i++)<br />
{<br />
int Divval=10/i;<br />
}<br />
}<br />
catch(dividebyzeroexception ex)<br />
{<br />
messagebox.show(ex.message.tostring());<br />
}<br />
However, the loop should contain a try & catch block in order to continue the loop
try<br />
{<br />
int intDivVal;<br />
for (int i =o ;i<5;i++)<br />
{<br />
try<br />
{<br />
int Divval=10/i;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("Oops, 10 / " + i + " failed!");<br />
}<br />
}<br />
}<br />
catch(dividebyzeroexception ex)<br />
{<br />
messagebox.show(ex.message.tostring());<br />
}
|
|
|
|
|
You should think about continuation that makes sense. You may return to an input for example, or substitute the illegal result with something that makes sense for you application. Just ignoring the exception is generally not a very good idea.
Rudolf Heijink
|
|
|
|
|
i have four fields in an exel file (EmpID, EmpName ,EmpSalary and DepartmentName) . I want to import these fields to a Datagrid view in my application and to database also. Pls help me with code of this application... I am using C# windows application .....
|
|
|
|
|
This[^] message may help... Anyway, removing a message and the reposting it certainly doesn't...
|
|
|
|