|
Try a search, there are literally 1000s of article/samples available. There is an excellent one on CP that should be easy to find.
You should do some research on using a datareader, I believe it locks the connection while it is active, therefore you will not be able to use the connection while the grid is active. Use a datatable instead.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
to set value in a cell, you must know its column index as well as row index.
dataGridView1[ColumnIndex, RowIndex].Value = "Myvalue";
divinyl wrote: To populate the datagridview, i'm using the sqldatareader object.
thats good
this article[^] may help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Dude. ..
Its better not to use a SqlDataReader object. as it locks the connection, and it requires you to keep it open.
You can use SqlDataAdapter and fill the table in datatable. And bind datagridview datasource to that table.
e.g:
SqlConnection cn = new SqlConnection("Bla Bla");
SqlDataAdapter adp = new SqlDataAdapter("Select * from Products",cn);
DataTable dt = new DataTable();
adp.Fill(dt);
datagridview1.DataSource = dt;
The changes you make on gridview cell will automatically be reflected on to the table..
So no worry on that .. .
|
|
|
|
|
Hi,
I have recently invested in a security system for my house using low lux colour/infrared CCTV camera's and an internal 8 channel DVR card (T-S808R) for my pc.
The DVR card uses the Philips SAA7130 chipset to encode the video, and has 8 registered devices in the Device Manager. They are registered as "DVR Video recoding device", device type "Sound, video and game controllers" and manufacturer "SAA7130".
Since the Philips chipset should be standard, I recon I should be able to read directly from the hardware driver, however I am unsure of how to do this.
Another way would be to intercept the MPEG4 video file that is created on motion (there is less than 1 second delay) and to interpret this video file, however I am unable to read the file (using a framework like the Tao Framework) to extract individual frames.
Can anybody please give me some advice, preferrably to read from the video driver, that could guide me to getting at the actual frames of the images for possible image recognition functions.
Thanks in advance
Stephan Johnson
South Africa
|
|
|
|
|
I am trying to write a shell extension in C#, which shows an item in right-click context menu in explorer. But all examples which I try contain a lot of code and doesn't show anything (i assume I do something wrong, or don't do some important step )
Many examples have static methods:
[System.Runtime.InteropServices.ComRegisterFunctionAttribute()]
static void RegisterServer(String str1)
[System.Runtime.InteropServices.ComUnregisterFunctionAttribute()]
static void UnregisterServer(String str1)
Should i call them, or they will be called automatically?
Does anyone have any ideas, or maybe knows any libraries/classes for that, where I can just call something like *.RegisterContextMenu(myMenu).. and ready ?
|
|
|
|
|
I am trying to read an Excel sheet to my program using OleDbDataAdapter into datatable , this is working fine except that if the excel column is text and taken into string field in the datatable its read as blank . anyone came across such a case .
I am using ,NET 2.o framework with visual studio 2005 - C# .
thankx
|
|
|
|
|
Actually , if the first data cell in the column is numeric , the full column is read as numeric and any text in the same column is read as blank .
and if the first data cell is text then the full column is read as text and any numeric cell in the same column is read as blank .
I have columns with mixed data , some numeric only and some are string .
any hints ?
|
|
|
|
|
In fact by default it ooks at the first 8 rows (odd number, really) and decides by that. Its a right pain, the last time I had this problem I ended up converting to csv and reading that.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
If an instance of an object subscribes to a static event, even if the instance goes out of scope it remains 'alive' which could potentially cause serious memory problems.
Obviously, the subscriber unregistering itself from the delegate's invocation list solves this, but is there anyway to do this from the class with the event rather than relying on the subscriber over which we may not have control (if we're not writing that code)?
I rarely use static events, this is more out of academic interest.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Maybe if you override the add of the static event and use a weak reference to store the delegate?
If that's even possible
|
|
|
|
|
I've just found a great article[^] on weak events. Some after dinner study there.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Nice, much better suggestions than mine
|
|
|
|
|
Lol, not at all - you pointed me in the right direction.
This other article[^] is also interesting!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Wow that took a while to read
This problem sure is a lot more complicated than I originally thought
|
|
|
|
|
Dave,
See here[^]. Jon Skeet has taken it neatly.
|
|
|
|
|
I need to have a databinding of List<book> or anything ..
I have SQL SErver and a functions which returns List<book> from Database..
Now if I am doing like this:
BindingSource src = new BindingSource();
src.DataSource = Book.GetList(); //A Getlist function from Book class returning the list<book> object.
datagridview1.DataSource = src;
Everything works fine..
But if I need to filter the bindingsource , I know we have a filter property like this.
src.Filter = "Author = " + anything.ToString();
But this is not working...
But if I am having a DataSource of DataTable having a table of Book . .
ie. . if I write..
src.DAtaSource = Book.GetTable();
Everything goes fine .. But on List it doesnt work properly . .
Can anyone help me out ???
|
|
|
|
|
I'm just getting into the List stuff as well, looks like you need to write your own filtering methods. Look into List<t>.FindAll.
I'm still to be convinced a List<> is better than a datatable/view for this stuff. Ah well research, it's what keeps us interested!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes It's preety fine to work with list. .
As it can be handled very easily. And also It can be easily used in 3 tier architecture.
Regarding the filtering of list , Actually list can be filtered using LINQ.
It can be done something like this;
var result = from p in lststudents
where p.FirstName = 'Jay'
select p;
This works fine. But I am more precisely talking about the filtering of Binding source.
It works with datatable , but not with List..
Anyway thanx for your concern. .
|
|
|
|
|
Hi,
not sure this is the place for the question as this is an architecture question, but i'm programming in c# so i came here.
My question involved a problem that I'm guessing a lot of programmers face at some point , My boss wants to send an email to a mailing list, that’s easy,
The mailing lists though should be created by the clients using the back office,
Not by picking users from the database, but by specific parameters, say
if the user is older than 18, or if the user order is from this or that store, basically almost any field in the database can be part of the mailing list criteria,
Question is:
how to display the parameters in the back office so the client which is a computer novice will be able to understand what he is doing
how to save the query in the database(which will probably include some joins and what not
Or maybe some other general idea on how to solve this problem
Thanks in advance
|
|
|
|
|
Hi, I am working on a task scheduler. Apart from scheduling tasks, daily, weekly, etc .. I would also like to let them run at login, but more importantly before the system shuts down.
I tried several methods already:
(1) by trying to intercept the shutdown and starting the application. At the moment it works but sadly the writer of this example code mentioned himself that it's not that trustworthy. It doesn't always work. So that’s not the best solution.
private void PreventShutdown()
{
SystemEvents.SessionEnding += new SessionEndingEventHandler(SystemEvents_SessionEnding);
}
private void SystemEvents_SessionEnding(Object sender, SessionEndingEventArgs args)
{
if (args.Reason == SessionEndReasons.SystemShutdown)
{
args.Cancel = true;
}
}
(2) by using the group policy settings, and placing a script file (task.bat) in the "windows\system32\grouppolicy\machines\scripts\schutdown" folder + a scripts.ini in the ... scripts folder. (apparently you can't access these GP, scripts settings programmatically)
If you do this manually (gpedit.msc) it works, but if you generate the files in code and place them in the appropriate folders it doesn't.
Can anyone help me with this problem. Is there anyone that has some experience with this, knows other ways to achieve my goal or maybe tell me what I'm doing wrong ?
Any help/suggestions much appreciated.
Thanx
modified on Sunday, March 8, 2009 8:57 PM
|
|
|
|
|
after some more googlin and reading thru msdn, I found the settings of the group policy scripts in the registry.
So I tried it like that; creating the right keys and values in code.
the tasks pop up in gpedit, scripts, shutdown ...
Every setting looks the same as when I would do it manualy with gpedit. Still when I shutdown the system, no batch file is being run. (the batch file itself works fine)
Is there nobody on this forum that has some experiance with this kinda stuff ?
thanx
|
|
|
|
|
Hello
I'm trying tu use mouse event (move, click) to select elements on a page on a printpreview control
But HOW can I get the page location relative to the princontrol Bound ?
Thank you very much for any help
|
|
|
|
|
hi
i used a Microsoft.Office.Interop.Owc11.ChartSpace object
it works and draw me a nice chart but when i use following code
if (ChartSpace.Charts.Count != 0)
ChartSpace.ExportPicture("C:\\abc.jpg", "Jpg", 640, 400);
it will be rise an exception "Unknown error."
with error code : -2147467259
what would i do?
thanks in advance.
|
|
|
|
|
i have com component which i converted to dll using tblimp tool. I am able to add reference of the dll to my code but when i call the function of the dll i get an error message saying "cannot find entry point"
could any one help me out in solving these issues.
|
|
|
|
|
It is very important to me to convert the webpage to images
pls help me out
I shall be grateful to you
|
|
|
|