|
hi !
u can do some thing like this ... if ur working in VS.net 2005---
right click the setup project>>> add prerequesites like .net framework , report viewer >> then from the radiobutton choose download from same location..to add framework in ur project ..
rebuild the project....
done...
else..
search google for ".net bootstrapper plugin" download and install that plugin. the framework will automatically added in ur project..
try it..
Abhinav
|
|
|
|
|
Hi
This is Dayakar
first of all i would say Thank's for your reply
i see your reply, but i am getting clearly
can you send clear details if possible
Regards
Dayakar D.N
|
|
|
|
|
how can i Shutdown PC on Lan by C#
|
|
|
|
|
There was a exact same thread yesterday (not shure which forum). Do a search!
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
using System.Management;
ManagementBaseObject mboShutdown = null;
ManagementClass mcWin32 = new ManagementClass("Win32_OperatingSystem");
mcWin32.Get();
mcWin32.Scope.Options.EnablePrivileges = true;
ManagementBaseObject mboShutdownParams = mcWin32.GetMethodParameters("Win32Shutdown");
mboShutdownParams["Flags"] = "1";
mboShutdownParams["Reserved"] = "0";
foreach (ManagementObject manObj in mcWin32.GetInstances())
mboShutdown = manObj.InvokeMethod("Win32Shutdown", mboShutdownParams, null);
|
|
|
|
|
using System.Management;
ManagementBaseObject mboShutdown = null;
ManagementClass mcWin32 = new ManagementClass("Win32_OperatingSystem");
mcWin32.Get();
mcWin32.Scope.Options.EnablePrivileges = true;
ManagementBaseObject mboShutdownParams = mcWin32.GetMethodParameters("Win32Shutdown");
mboShutdownParams["Flags"] = "1";
mboShutdownParams["Reserved"] = "0";
foreach (ManagementObject manObj in mcWin32.GetInstances())
mboShutdown = manObj.InvokeMethod("Win32Shutdown", mboShutdownParams, null);
|
|
|
|
|
Hello,
I am writing one simple C# .NET application in which I have to use some values retrieved from the database. But when I try to retrieve value of attribute of type Time without time zone it generates following exception
{"Index was outside the bounds of the array."}
System.Exception {System.IndexOutOfRangeException}
This happens only when I try to retrive this type .. for other attribute types, it is working properly.
My code is ...
//--------------------------------------------------------------
String myQuery = "Select starttime from tblecture";
OdbcCommand myCommand = new System.Data.Odbc.OdbcCommand(myQuery, conn);
OdbcDataReader dataReader = myCommand.ExecuteReader();
while(dataReader.Read())//Exception being generated on this line
{
//code to use database info
}
//--------------------------------------------------------------
Schema of tblecture table is:
Table "public.tblecture"
Column | Type | Modifiers
-----------------+------------------------+----------------------------
lectureid | integer | not null
starttime | time without time zone |
Thanks,
Regards,
Kranti
|
|
|
|
|
How can I assign a integer value to the RecordNumber Field in crystal reports? Can similarly assign values to PageNumber Feild too? If so please explain how to do these?
Looking for a favorable reply..
Sam J
|
|
|
|
|
code for detecting an IP address
|
|
|
|
|
string hostname=Dns.GetHostName();
IPHostEntry h=Dns.Resolve(hostname);
Console.WriteLine("IP addresses for "+hostname+":");
foreach (IPAddress ip in h.AddressList) {
Console.WriteLine(ip);
}
Also
http://www.codeproject.com/csharp/network.asp[^]
|
|
|
|
|
Is there a quick and easy way to get a bitmap from a control's Graphics object? I have a Panel object that I've drawn some stuff on, and I want to generate a bitmap from it. If that wasn't possible, I was also thinking of maybe drawing stuff onto a bitmap, but Bitmap objects don't have Graphics objects...
Any ideas or suggestions?
-Daniel
|
|
|
|
|
This may be of some use:
http://www.codeproject.com/csharp/imagecapture.asp[^]
Looking at the MSDN docs, it simply enough to get an Graphics object from an Image, but getting an Image from an existing Graphics object appears to harder. By the looks of it, it will involve handles/pointers and possibly using P/Invoke
-- modified at 19:58 Tuesday 25th April, 2006
|
|
|
|
|
|
The second alternative you are suggesting is the better one. You can get a Graphics for a bitmap this way:
Bitmap bitmap = new Bitmap(panel.Width, panel.Height);
using (Graphics g = Graphics.FromImage(bitmap)){
}
panel.DrawImageUnscaled(b, 0, 0);
bitmap.Save("C:\\test.bmp");
|
|
|
|
|
I felt kind of dumb after I found that method (Graphics.FromImage()). However, every time I try to save the bitmap, it gives me a sort of generic GDI+ error (but doesn't crash the program). I'll figure it out one of these days.
Basically, I'm trying to draw a lot of crap onto a Panel (on a tab page). The crap is dynamic (changes often during runtime, in different tab pages), and so it needs to be redrawn often. But I don't want it to redraw it all every time the Panel needs to be repainted (for some reason, it all disappears unless I tell it redraw all the crap, like with window resizing). I figured if I drew it once to a bmp (when needed), and then just set the bmp to the Panel's background image, it wouldn't flicker so bad with repainting (like with window resizing and stuff).
I'll figure it out eventually.
Thank you all for the help! I love this site!
-Daniel
|
|
|
|
|
That it needs to be repainted is just how windows works. You have to catch the Paint event (or override OnPaint) from the panel and draw your stuff there everytime it gets called. Using a back buffer is nevertheless a good idea.
|
|
|
|
|
Alrighty, thanks!
(I feel even dumber having forgot about OnPaint... blasted semester finals...)
-Daniel
|
|
|
|
|
I am a huge C# newb trying to learn how to write a simple program. I am having a problem copying a file to another directory.
Lets say i copy C:\test.exe to C:\copy\text.exe. The file copys to the right folder but it ends up with both files having 0 bytes.
any help would be appreciated
Private void button6_Click(object sender, EventArgs e)
{
string path = textbox1.text
string path = textbox2.text
try
{
using (FileStream fs = File.Create(path))
File.Delete(path2);
File.Copy(path, path2);
textbox3.text = "file is copied"
}
catch
{
textbox3.text = "error"
}
}
Don't be overcome by evil, but overcome evil with good
-- modified at 18:44 Tuesday 25th April, 2006
|
|
|
|
|
That's because you are overwriting the source file! Just delete these two lines, there are unnecessary:
using (FileStream fs = File.Create(path))
File.Delete(path2);
File.Copy is the only line you need to use within the try catch. If you want to allow overwrites of exsiting files you can add true as a third parameter.
Regards, Graham.
|
|
|
|
|
Thanks alot man i appreciate it alot. It works perfect.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Take a look at these two lines:
string path = textbox1.text<br />
string path = textbox2.text
You can't create two variables with the same name, so obviously this is not the code that you are actually using.
Assuming the rest of the code is at least reasonably similar to the one that you are using:
You create a new file but you are not writing anything to it. Of course the length of the file will be zero.
---
b { font-weight: normal; }
|
|
|
|
|
i accidently made a typo there. that wasn't what i had in my original code. It was path2 for textbox2.text.
thanks for you help tho
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
I have a DataGrid that uses a DataTable as its source of information to display and looks something like this:
Name Black_Car Brown_Car Red_Car
Ted 8 4 6
Jim 3 1 0
Bob 14 0 2
Total 25 5 8
Each Black_Car, Brown_Car, Red_Car, and Name column name is a link that sort the column in descending order when clicked. What I would like to do is add one more row at the bottom that say "Total" in the Name column and the sum for the other three columns. I was able to add the "Total" row with the sums, but whenever I click the column name link to resort, the "Total" row with the sums would be resorted also. I don't want the "Total" row to be resorted, I want it to always remain at the bottom of the table. I would really appreciate any help, thanks.
-- modified at 17:35 Tuesday 25th April, 2006
|
|
|
|
|
Hi,
the DataGrid doesn't have any inbuilt functionality to achieve what you want. But probably we can find a workaround. For this it is important to describe a bit more:
1. Should your grid be editable by the user?
2. Is the table filled via some sort of database connection or are you filling it manually?
|
|
|
|
|
The DataGrid is not editable by the user and the table is filled by reading in values from a text file.
|
|
|
|