|
I am developing a add-in and I've planned to write an article about it, but I am facing VERY annoying problem that I can't figure out.
I've loaded up virtual machine to test a real time behavior of the add-in and notice this problem.
When I am run add-in (F5) from it's project, context menu items adds to the menu of the code window and aspx context CommandBars.
After I build a setup (containing .dll, .addin file and adding proper value in registry) and opening a project, add-ins main window loads, but context menus don't.
I have two folders in the installation folder.
One is for VS 2005 and other for VS 2008.
First time, I was testing with only one folder (for VS 2005) and context menu items was working.
Further on, I've added second folder to the setup project, build it and send to to virtual machine for testing.
Context menus didn't show up.
Ever since then I was unable to get them work.
I also though that setup is building with wrong .dll, but I am pretty sure that's not the case.
To exclude that possibility, I've manually added .dll file to the install folder.
Add-ins main window works on both Visual Studios.
Please help!
This is driving me crazy!!!
And sorry if I was confusing...
|
|
|
|
|
Hi,
I must be missing something very basic so please excuse the seemingly simplicity of this question:
Question: How does one create an array of classes in C# without having to call the constructor for each elment in the array.
Example: In C++ one would do the following:
<br />
class MyClass<br />
{<br />
public:<br />
int myData;<br />
<br />
MyClass::MyClass()<br />
{<br />
myData= 1;<br />
}<br />
};<br />
In main:
void main()<br />
{<br />
<br />
MyClass myVar[12];<br />
<br />
cout << myVar[0].myData;
}<br />
For C# I try this (ignore any syntax errors that may exists):
<br />
void Main()<br />
{<br />
<br />
MyClass[] myVar = new MyClass[12];<br />
<br />
Console.WriteLine("{0}", myVar[0].myData);
<br />
}
Can this be done in C#, if so, how?
-Joe
|
|
|
|
|
Hi Joe,
in C# you can not; you need to create the array as in your statement
MyClass[] myVar = new MyClass[12];
but this gives 12 null references.
Now you may or may not load the array with an explicit loop containing myVar[i]=new MyClass();
Luc Pattyn [Forum Guidelines] [My Articles]
This month's 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.
|
|
|
|
|
That's because you are not doing the same thing in the C++ code as in the C# code. A class in C++ is not the same as in C#.
In the C++ code you are declaring an array of value types. The equivalent in C# would be to use a struct instead of a class.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: The equivalent in C# would be to use a struct instead of a class.
Even then, he'd have to write additional code to initialize the data members. The best overall solution is to use a generic list
using System.Collections.Generics;
namespace MyApp
{
class Program1
{
public class MyClass
{
private int m_data = -1;
public int Data
{
get { return m_data; }
set { m_data = value; }
}
public MyClass()
{
m_data = -1;
}
public MyClass(int data)
{
m_data = data;
}
}
static void Main(string[] args)
{
List<myclass> myClasses = new List<myclass>();
for (int i = 0; i < 12; i++)
{
MyClass myClass = new MyClass();
myClasses.Add(myClass);
}
}
}
}
</myclass></myclass>
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Even then, he'd have to write additional code to initialize the data members.
That's true. In .NET there isn't any automatic construction going on without specifically asking for it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa,
You were so right on about taking the structs approach, that got me exactly what I needed.
Thanks!!!
|
|
|
|
|
Be ware, though, that structs are a bit trickier than classes. You should read a bit on the recommendations on structure implementation:
MSDN: Structs[^]
MSDN: Value Type Usage Guidelines[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have a spread sheet of addresses that are in different formats.
Some of the addresses include cities or zip codes or floors or units, the formats for floor is "flr" or "floors" or "flrs"...I think you can see what I am getting at.
Is there a good parser library out there for use?
shwaguy
|
|
|
|
|
shwaguy wrote: Some of the addresses include cities or zip codes or floors or units, the formats for floor is "flr" or "floors" or "flrs"...I think you can see what I am getting at.
Not really.
If you need to match patterns in text, Regular Expressions[^] are your best bet.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
OK....I am familiar on the regular expressions thing.
I am looking for a library that already has done this.
What does Google do? Does it use a database?
shwaguy
|
|
|
|
|
on pressing button in Form 1, it opens FORM2 and hide itself. But the problem is the FORM2 pops up in different location of the screen..and when i exit that, FORM1 pops up but thats in different location.Whereas i want this to be at the same location. Just looked over properties to set the location but even when i set the same location on both the forms, it results in poping up at different place.
What can be the reason for this ? I am sure its one of the easiest thing to do but sometime that gives you heading too...
Thanks
|
|
|
|
|
Hi,
setting Form.Location only works the way you want if you first set
Form.StartPosition=FormStartPosition.Manual;
Luc Pattyn [Forum Guidelines] [My Articles]
This month's 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.
|
|
|
|
|
Hi!
I have three tables created in SQL Server:
Tabe for Ingredients:
Ingredients
CodIng (INT) Primary Key
Descrip
Cost
Table for Recipes:
Recipes
CodRec (INT) Primary Key
Descrip
Table to specify the Ingredients that a recipe has:
RecipesIngredients
CodRec (INT)
CodIng (INT)
Quantity
I want to show RecipesIngredients for a given CodRec in a datagridview and modify it (for example add, remove or modify ingredients in a recipe) but I also want to show the description for them.
I mean I want to show in the datagridview FOR A GIVEN RECIPE (not for every recipe) these columns:
CodRec, Descrip (Recipe), CodIng, Descrip (Ingredient), Quantity
Which is the best way to do this?
Thank you!
|
|
|
|
|
hi
write a SQL query using joins in SQLdataAdapter.Using this adapter fill a datatable and bind this table to datagridview. The query will be like,
"select RI.CodRec,REC.Descrip,RI.CodIng,ING.Descrip,RI.Quantity from RI as RecipesIngredients,REC as Receipe,ING as Ingredient where RI.CodRec='receipe code' AND RI.CodIng=ING.CodIng AND ..."
This query may not give the result u want,but u have to use joins like this to get the desired result.
|
|
|
|
|
Ok, I knew how to show it.
The probem is that I will not be able to modify, insert or update the ingredients for a given receipe with that table binded to my datagridview...
Or is it possible?
|
|
|
|
|
Hi!
I am trying to write and application which will capture moving object from video camera and then move the cursor.
I will appriciate any help and guidence..
Thank you!
=Mani=
|
|
|
|
|
There's a commercial library called TVideoGrabber that offers this. If you need to write it yourself, you need to write a DX filter so you can examine your frames and look for movement.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hey folks, I think this is my first time asking a question here, so please go easy on me
I have an application wherein I render a transparent bitmap (to be specific -- a chart with a transparent background).... When I do, I then try to copy it to the clipboard using:
<br />
bmp.Save(filename);
Clipboard.SetImage(bmp);
Now if I open Excel, and click Paste (from the clipboard), I end up with a copy of my chart with this lovely blue background wherever the transparency color was.
If I, instead, use Excel's Insert->Image->From File, the chart's transparency is preserved... (same bitmap as above, just one is saved to file system, the other is copied via clipboard)
What gives? Am I copying the bitmap incorrectly, or is there something else I need to do to make copy and paste of transparent bitmaps a reality?
(I have searched high and low, and nothing seems to answer this question... I have tried all kinds of things to resolve this on my own, even using MakeTransparent() (which has no effect, since the bitmap was already transparent to begin with (as evidenced by the Flags value on the bitmap being "2" which is hasTransparency)... I have tried converting the image, using color maps, using SetClipboardDataObject, converting to an HBITMAP object or whatever.... all kinds of things, nothing seems to avert this issue....)
Thanks in Advance!
=============================
I'm a developer, he's a developer, she's a developer, Wouldn'tcha like to be a developer too?
|
|
|
|
|
Transparency is only supported by some file formats, such as PNG. The raw BITMAP format, which is what Windows uses internally, does not support transparency. The Bitmap class does allow setting a color that is transparent, I *think* ( it may be that the support only exists at the point of drawing the image ), but ultimately I suspect what you're finding is that the clipboard contains a raw image, not an image in, say, PNG format. That's if Excel can work it out. More likely, an image in the clipboard is a plain vanilla bitmap, and the image when loaded by Excel, is loaded as a PNG or other format with transparency support, and thus it's respected by Excel, because it's still there.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm writing an windows service, which accept connections via a TCP/IP socket. I want to verify the connectin users against windows accounts on the local machine.
Do anyone know if there are somthing in .net to do this??
I have looked in System.Security.Principal, but all I could find was "current loged on user", which is not much of help. I would like to have somthing where I pass a username and password and get "accept / denied" or perhaps a usergroup or simular back.
Ola Ericsson
|
|
|
|
|
I need help coding the following pseudo code into C#.
The 3 algorithms are search methods for a program which can look through a set of data to find the subsequence of values which add
up to the highest total value.
So for example with the data set.
10 -6 12 -17 9 8 -2
the algorithm(s) show that the "best" value was 17 from array index 4 to array index 5 if you go through it. (9 + 8)
10 - 6 = 4
10 - 6 + 12 = 16
10 - 6 + 12 - 17 = -1
10 - 6 + 12 - 17 + 9 = 8
10 - 6 + 12 - 17 + 9 + 8 = 16
10 - 6 + 12 - 17 + 9 + 8 - 2 = 14
-6 + 12 = 6
-6 +12 -17 = -11
-6 +12 -17 + 9 = -2
etc
For every possible start position // every array index
For every possible end position // rest of array from current start
{
Set subtotal to 0
For every value in subseq // between current start and end
Add profit value to subtotal
Update subseq info when subtotal exceeds current best total
}
For every possible start position...
Set subtotal to 0
For every possible end position...
{
Add end position’s profit value to subtotal
Update subseq if subtotal exceeds current best total
}
Set start position to 0, subtotal to 0
For every profit value... // index from 0 to end of array as end position
{
Add value to subtotal
Keep subseq info (start, end, total) if total exceeds current best
If total is less than 0,
set start position to next index and set total to 0
}
I need help creating C# versions of these methods which compile and run.
Thanks
|
|
|
|
|
How far have you got in trying to do your homework ? WE're not going to do it for you.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
srmanuel wrote: I need help creating C# versions of these methods which compile and run.
What is it that you need help with, specifically?
The assignment is pretty straight forward. The work to figure out how the code should work is already done, you just have to write the code itself.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hy everyone!
does anyone of you know how to insert checkboxes into datagrids?
if i search the net for hints there are just solutions for VB but none for C#. I guess if it is possible to do it in VB then it should also be possible in C#. When I do it in a similar way the only result is tons of error/compile messages because I can't bind them etc.
Does anyone know if it is possible in C#?
thanks.
Stephan.
|
|
|
|