|
Hi,all
I want to use Dictionary<> to make a map.I create a class named ILayer.So,I write
Dictionary<string, ilayer*=""> g_LyrNameToILayer =
new Dictionary<string, ilayer*="">();
But it was wrong,who can tell me what shoud i do? Thanks a lot!
|
|
|
|
|
The generic Dictionary<> class has to be parameterized with two types (one for the keys and one for the values).
Guessing from your variable name you must write something like this:
Dictionary<string, ILayer> g_LyrNameToILayer = new Dictionary<string, ILayer>();
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks,What you said is right,but,i want the Key is type of string,and the Value is type of pointer,It seems to be that pointer can't be a para in Dictionary.
so,how shoud i do?
|
|
|
|
|
What mav is saying should be sufficient if you're mapping up 'Name' with an instance of 'ILayer'.
Dictionary<string, ILayer> layerDict = new Dictionary<string, ILayer>();
List<ILayer> layers = GetLayers();
int counter = 0;
foreach(ILayer layer in layers)
{
layerDict.Add("Layer" + counter, layer);
counter++;
}
...
ILayer layerOne = null;
if(layerDict.ConstainsKey("Layer1"))
{
layerOne = layerDict["Layer1"];
}
Best regards!
-Larantz-
|
|
|
|
|
|
|
I am trying to create a persistent pub-sub application using wcf.
When a client subscribes to the service it passes a URI and a mehtod name.
When the service needs to callback the client it connects to the URI using a known contract (which can be passed too in a more complex scenario) and activates the method.
My problem is how to listen to the URI on the CLIENT after subscribing.
I know how to do that using a ServiceHost but all I need is a listener for the contract the client exposes.
Is there a way of listening to an "ICallback" (not IReplyChannel or IInputChannel)?
Thanks,
xshift
|
|
|
|
|
Hello everyone,
I have used gacutil tool to install my COM dll into Global Assembly Cache,
http://msdn2.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx
But I am not sure whether I need to manually copy the actual assembly dll into some directory (like Windows\System32? Windows?) after running this tool? Or gacutil tool will automatically copy (install) the assembly for me -- so I only need to run gacutil -i <dllname>?
thanks in advance,
George
|
|
|
|
|
Hi!
You don't have to copy the assembly somewhere else. That's what the GAC is all about...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav!
You mean GAC will store the dll in some hidden place? I have searched my machine but can not find where GAC has copied my dll.
A further question, I think when a CLSID is used for CoCreateInstance, GAC should be used for searching the codebase dll containing the implementation of the CLSID, right?
But, for most COM server, they are not in GAC (in GAC, if we list all entries, only tens of items.), so I think there should be some other ways to find codebase dll, other than through GAC, right? So, what are the other ways to find CLSID related codebase dll?
regards,
George
|
|
|
|
|
You can see what's in the GAC more easily than using gacutil by pointing your windows explorer to %WINDIR%\Assemblies .
When a COM server must be created, windows takes a look at HKCR\CLSID\COM Class ID\InprocServer32 (I'm skipping out-of-proc servers deliberately to keep it simple).
The value of this key is used to find the dll containing the implementation (a little simplified, once again).
For managed COM servers this value points to mscoree.dll and only for this type of servers the CodeBase value is neccessary. You can run regedit and then search for "codebase" inside of HKCR\CLSID to see several examples for the required structure of registry entries for managed COM servers.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav,
Your described process to load related dll is informative. But it has nothing to do with GAC? I am wondering what is the function of GAC in your following process?
BTW: I find in my Windows registry there are additional Assembly and Class value -- not every mscoree.dll has CodeBase.
I think Assembly is the name in GAC, and Class is for the entry point CLSID for CoCreateInstance? Right?
mav.northwind wrote: When a COM server must be created, windows takes a look at HKCR\CLSID\COM Class ID\InprocServer32 (I'm skipping out-of-proc servers deliberately to keep it simple).
The value of this key is used to find the dll containing the implementation (a little simplified, once again).
For managed COM servers this value points to mscoree.dll and only for this type of servers the CodeBase value is neccessary. You can run regedit and then search for "codebase" inside of HKCR\CLSID to see several examples for the required structure of registry entries for managed COM servers.
regards,
George
|
|
|
|
|
I didn't look into every detail of the registration of managed COM servers, but Junfeng Zhang has a very valuable blog talking about the inner workings of fusion, COM activation, the GAC and other related topics:
http://blogs.msdn.com/junfeng[^]
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks mav,
The blog is very informative. A lot of information... Could you let me know which part do you mean? I felt I lost my way when reading the Blog for 10 minutes.
regards,
George
|
|
|
|
|
I finally got visual c# studio to install on my computer! My grandpa, who's visiting, downloaded the iso images to his computer and burned it to a cd for me, because my dad's can't burn cd's. It's installing as I am typing this... Thank you guys for helping me along the way. Sorry, I didn't know if I should post this here or not... I hope I don't get in trouble 'cause it's not a question...
Oh, and don't mind the sig...
-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***
|
|
|
|
|
max29297 wrote: I finally got visual c# studio to install on my computer!
Cheers, have fun with it
Maybe you can change your sig about not having VS
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Wow, I've tried it and it makes Windows Form Applications much easier to make. It's a lot better than guessing the x and y values for every single control...
Paul Conrad wrote: Maybe you can change your sig about not having VS
Well maybe you should've looked at the last line of the message you just quoted...
If I had a sig, it would probably go here.
|
|
|
|
|
Gz!
Now finally you can start developing like decent people do
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
So you're saying I'm not decent?
If I had a sig, it would probably go here.
|
|
|
|
|
Please take a look here.[^]
The smiley should have been hint enough.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
I want that create and print report with c#
but i want do every thing by code and don't use any option in visual studio
please help me
|
|
|
|
|
What part, specificly, are you having trouble with?
I get all the "news" I need from the weather report.
|
|
|
|
|
i just write this code in class named BindReport
public DataSet GetDataSet()
{
SqlConnection sqlconn = new SqlConnection(_connectstring);
SqlDataAdapter DA = new SqlDataAdapter("select aman_no,aman_name,aman_area from aman", sqlconn);
DataSet ds = new DataSet();
DA.Fill(ds,"aman");
return (ds);
}
and this code in form load
BindReport obj = new BindReport();
DataSet ds = obj.GetDataSet();
CrystalDecisions.CrystalReports.Engine.ReportDocument myRPTDocu = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
myRPTDocu.Load(@"..\..\CrystalReport2.rpt");
myRPTDocu.SetDataSource(ds);
crystalReportViewer1.ReportSource = myRPTDocu;
and this code not work and give me exception "the report has no tables"
|
|
|
|
|
Hi,
I have the following situation and struggling with it. So hopefully someone can solve it or perhaps advice me another method. What I have is an Excel spreadsheet and a c# program.
In the program i load the excelsheet into a datatable
<br />
Cursor = Cursors.WaitCursor;<br />
InitExcel(ref _exr);<br />
_dt = _exr.GetTable();<br />
So far so good. I can than loop trough the rows from the datatable like this
foreach (DataRow da in _dt.Rows)<br />
{
and so on. What i would like to achive now is the following. In my datatable there are many rows. I would like to group rows where a certain column has the same value. It is a fact that rows where this is the case are underneath each other. So it thought lets move to the next row to see if the value is the same. if so read some columns and move on to the next row and do the same check. If the value is the same read the samen columns. If not i have another row and start over again. The result should than look something like
Source table
100;Nice product;100.0;Variant 0
100;Nice product;100.1;Variant 1
100;Nice product;100.2;Variant 2
200;Another nice product;200.0;Variant 0
200;Another nice product;200.1;Variant 1
200;Another nice product;200.2;Variant 2
100 Nice product
....100.0 Variant 0
....100.1 Variant 1
....100.2 Variant 2
200 Another nice product
....200.0 Variant 0
....200.1 Variant 1
....200.2 Varian 2
and so one. but i have not got a clue how to do this. I cannot figure this out. A bad but working solution is to add the datatable to a hidden grid on the form and perform this actions on the grid. but that is not the solution i am looking for
Hope this makes any sense and that someone can help me solve this issue
Kind regards,
Marcel Vreuls
http://www.marcelvreuls.com
< >
|
|
|
|