|
Hi there
I seem to remember seeing an article where someone showed how to populate a System.Windows.DataGrid on a Form by using databinding. Almost like how it's done in Asp.Net.
Or is the only way to work with a WinForms datagrid, to databind to a DataTable in the disconnected way?
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
I am trying to develop a control which will be some what similar to Sql Server Relation diagram.
Problems:
1.
I inherited my control from a list box. Now i want to draw, but the problem comes when i draw any thing it doesn't get displayed. But when i copy paste code on a form it displays the items. Couldn't understand why it doesn't work on a control.
2.
I don't know how to drop any thing on a control. I tried a simple drag drop by draging an item from a list box to my control nothing happend.
need help! plz.
|
|
|
|
|
Hi
This is Dayakar,i have one problem
i.e i have one exe file,i given to some other person now he was loading that exe but in his machine does not have any framework to load that exe. At that time default it will load all the things which are required to load that exe.
How to achive this in asp.net
-- modified at 8:55 Wednesday 26th April, 2006
Hi
This is Dayakar,i have one problem
i.e I want to execute the dotnet files without haveing dotnet environment
To solve that problem my friend told that if you have to install dotnetfx.
Is that process is right or wrong if it is wrong can you tell any other possible solutions
How to achive this in asp.net
|
|
|
|
|
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
|
|
|
|