|
Man i'm looking for the exact same thing...Thinkin of writing my own listview from scratch...lol
|
|
|
|
|
Hi!
I'm trying out the regular expressions in C# (.NET); but I can't compile my source. The compiler complains about not recognizing "RegularExpressions". Fair enough, I thought. I just need a reference, right?
I have "using System.Text.RegularExpressions;" at the top of my file, of course. Problem is I can't add an assembly reference! When trying to I can't find the System.Text.RegularExpressions dll! I actually tried to seach my whole drive for it, and the only one found was in the compact framework and I can't add that one.
What am I doing wrong here?
PS.: Funny thing is, that the samples folder from the SDK (or maybe the IDE) contains some regular expressions samples with both source and .exe and I can run the .exe without problems (which uses the required dll at runtime)....
|
|
|
|
|
After searching Google groups I found out what to do. I needed to add a reference to System.dll in VS. I was under the impression that the System namespace was referenced by default?
|
|
|
|
|
The name of the DLL (or assembly) is completely unrelated to which namespaces the types it implements are in.
The 'core' namespaces are spread between mscorlib.dll and System.dll. The most critical ones that are required for even the most basic bootstraping are in mscorlib.dll. This isn't just the System namespace, but Collections, IO, Reflection, Remoting, Serialization, Security, etc. The ones that other things don't depend on as much and hence may never need to be loaded are in System.dll. This includes CodeDom, ComponentModel, Net, RegularExpressions, etc.
Don't let the names of the other DLL's fool you either, for example System.Data.dll mostly implements types from the System.Data namespace, but it also implements some types that are in System.Xml and so forth.
-Blake
|
|
|
|
|
Thanks a lot - that was a very helpful answer. It clears all up for me. YAY
|
|
|
|
|
hi all :
I want to make a solution that have 3 projects ,1-web app 2-win app 3-mobile app , iwant to use asp.net web services to link between them all ,the win app is connected to a local DB server(sql server) ,and connect to the internet 1 time per day,and the web app is connected to a remote DB server (sql server) ,and also the mobile app.
the questions are :
1- how can i use Asp.net web services well to make the solution works well?
2-How can i manage the DB ?and how can i make daily transaction to update the remote server with the new data at the local server?? or what??
3-how can i use the same methods for dealing with the DB ,for the win app , the web app and the mobile app?
hadada
MCDBA, MCSD, MSAD
|
|
|
|
|
I have created my own resx file and have embedded it into a dll. I want to create a dll containing all of my app's resources with a class that will retrieve these resources. The problem is, when I do GetObject() it returns a string not an object and I get an invalid cast error. Bellow is my code. The dlls name is Resx.dll and the resource file it contains is Resources.resx. Any ideas???
using System;
using System.Drawing;
using System.Reflection;
...
public class Resx
{
public Resx()
{
}
public static Icon Icon(string resx)
{
Assembly a = Assembly.GetExecutingAssembly();
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager("Resx.Resources", a);
Object o = resources.GetObject(resx);
Console.WriteLine(o.GetType().ToString()); //outputs type String
return (Icon) o;
}
}
|
|
|
|
|
Hi All,
I still having real trouble with this. Any help would be greatly appreciated.
Thanks in advance,
Scott.
|
|
|
|
|
hi all...
i wanna to develop an application to shut down the computer using C#....
i did it and call ExitWondowsEx API......it works fine in windows 98.... but in windows xp
it doesn't work....becauseof the priviliges..... does any one know the code in C# to handle the priviliges??....... or does any one know how to use Sytem.management to shut down the computer???
thx in advance
|
|
|
|
|
I am reading a graphic into an image (Image class) and displaying it on a form. Among other things, I am providing methods for moving the image around on the screen using the mouse. When the user clicks on the image I would like to shade the image (tint?) so that the user knows the image is selected. Similar to (or exactly like) like an icon changes color when the user selects one on the desktop. Any ideas about the best way to do that?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
graphics.FillRectangle(new SolidBrush(Color.FromArgb(80 ,SystemColors.Highlight)), imageRect);<br />
graphics.DrawRectangle(SystemPens.Highlight, imageRect);
-Blake
|
|
|
|
|
Hey Guys, bit of a C# newby, so if you could point me to a relevant article, or give a few tips would me much appreciated. I've got a file, which I load and decompress to ASCII text in a C++ dll (would have no idea how to do it in C#, unless there's a zip library for C#) and can import that into C# like:
byte * pBuffer=0;
int bytes;
if(DodgyImportFunction(sourceFile,&pBuffer,&bytes))
{
if(bytes>0)
{
//at this point have a pointer to a bytes byte*, but I need it as
//byte[] and C# won't be nice and let me cast it, so I can use it as
//ASCII text.
}
}
Any ideas of a better solution so I can get the decompressed data to be treated as ASCII text in C#?
Thanks, Brian.
|
|
|
|
|
Copy it into a string using Marshal.PtrToStringAnsi().
private static extern bool DodgyImportFunction(
string sourcefile,
ref IntPtr buffer,
ref int bytes
);
IntPtr pBuffer=IntPtr.Zero;
int bytes;
if(DodgyImportFunction(sourceFile,ref pBuffer,ref bytes))
{
if(bytes>0)
{
string str=Marshal.PtrToStringAnsi(pBuffer,bytes);
}
}
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Thanks heaps, that worked a treat!
You ripper, would've taken me ages to work that out.
You beauty!
|
|
|
|
|
Hi!
How does one retrive the IP-address of the remote host? I can only retrive the AddressFamily, and can´t find out how i retrive the address. Can I get the IPEndPoint for the remote host in some way??
søren christensen
|
|
|
|
|
Allow me to answer my own question. To retrive the IP-address og the remote host you can call RemoteEndPoint on the Socket connection, which you the call ToString() on to get IP and port number.
<br />
Socket con = Server.Accept();<br />
<br />
Console.WriteLine( con.RemoteEndPoint.ToString() );<br />
s-christensen
|
|
|
|
|
Hello,
I have been looking at some boooks today to trynd find an example of displaying a bitmap on the screen and I found code hat did not help just give me errors.
How would I draw 'me.gif' on the screen in C# using GDi+?
I would really like your help! ;);P
Cheers,
Rob
|
|
|
|
|
You can draw it on a form using the Graphics.DrawImage() method:
Graphics g = this.CreateGraphics();
g.DrawImage(bmp,new Point(0,0));
HTH
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Hello,
I have a project that uses a MDB file for it’s data. I am trying to make a setup and deployment project to install it the problem I am having is the path in the Crystal Report is seems to be hard coded from the wizard. I want it to use the path the exe is running when I try to set this in the IDE it throws a error. Is there a way to have the setup and deployment project set the path for this or is their a way I can do it?
Thanks for any help.
|
|
|
|
|
This isn't the responsibility of an install. The Crystal Report should be programmatically directed to the MDB by the program. If you're using the managed interfaces for Crystal Reports, you can use an OLE DB connection to the MDB file in your EXE's path (easy to get). Query something to generate a DataSet or something, then call ReportDocument.SetDataSource .
Besides, to set the path to the MDB in an install, you would have to write a custom action that actually changes the binary RPT file format, which isn't documented (to my knowledge). This is a proprietary format.
In any case, this is the responsibility of the program that displays the report. There are ways to programmatically set the report's data source at run-time and that is what should be done.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks but I must be missing somthing. I am trying to learn crystal and have a hard time. It seems to me in order to use reportdocument, I have to use reportdocument.load and I need to provide this a path and that will put me with the problem I started with. I have a report file already made.
|
|
|
|
|
Never mind I got it. Like I said a bot slow
|
|
|
|
|
I have created a service in C#.
The service loads a COM dll (it uses OLE DB classes) on startup which handles the database
connectivity part (SQL server).
When I startup the service it works fine for a local database but when the database is
remote the Open fails with an error.
The exception that is written into the Event Log is as follows:
"[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied."
"System.Runtime.InteropServices.COMException (0x80004005): [DBNETLIB][ConnectionOpen
(Connect()).]SQL Server does not exist or access denied.
To zero-in on the problem I ported the Database related code into a separate exe and found
that it works fine. SO this problem seems specific to a Service.
I am running the service logged is as a System Administrator and given full access to it at
the Remote server.
Has anybody faced this problem before. Pls help.
Coding is injurious to health!!
|
|
|
|
|
1. If you're connecting only to SQL Server and not any other DB systems, use the System.Data.SqlClient instead of OLE DB. These are classes written specifically for SQL Server with a lot of optimizations and additional features over OLE DB.
2. The problem seems to be security. When you put it in a Windows app, it runs under your user credentials (be default). If you are using SSPI to connect to the SQL Server with a trusted connection, your credentials are authenticated and authorized by SQL Server, so you're app can access it.
Typically, most Windows Services use the LocalSystem account. If your connection string is using SSPI and the LocalSystem (SYSTEM) account is NOT added to SQL Server as a viable user that can access the system, you'll get Access Denied.
You should either use a fixed User ID and Password in the connection string, as well as Trusted Connection. Or, continue to use Integrated Security=SSPI and add the SYSTEM account to SQL Server for that database and grant it the rights necessary to run (I wouldn't recommend making it a dbo, though).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Good advice Heath,
One more thing to add, is that if your service and SQL Server are on different boxes then you can't use or add System to an authorized account on SQL Server. Local System, uses a null user and null password to make autorization attempts against remote resources, unless you have null session shares turned on (NEVER DO THIS) it won't work.
You're best be is to create a domain account for your service, configure your service to run under this account and add this account to your sql server as a login and a user in your database.
If you do not have a domain, then as long as the same account exists on both boxes and has the same password you can still connect.
|
|
|
|