|
Hi,
Please try the following code snippet to update Grid and underlying database simultaneously.
BEGIN CODE
dgv1.Update()
ds1.AcceptChange()
dgv1.Refresh()
END CODE
Regadirding the other issue I would suggest you to take a look at following sample. It show how we can show a newly added row (via Form) in DataGradView and other ADO.Net features.
http://www.speedyshare.com/193952422.html[^]
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Dear Sir,
1.we are developing one project. in that we are using "CODEC"
com object for video recording & displaying.
2.Coder records the video. Decoder Disply the video.
3.We used Windows Media Encoder 9 series SDK.
4.we used WME-Interfaces(we used WMEncoder & IWMensouce Interfaces,... )
for recordig video,displying video etc....
5.In this i have option to merge the existing videoo with recording video.
6.i can merge video or images to the recording video.
7.FOR RECORDING WE ARE USING " WINDOWS MEDIA VIDEO 8 FOR LOCAL AREA NETWORK
384 kbps
8.FOR MERGING WE ARE USING " WINDOWS MEDIA VIDEO 8 FOR LOCAL AREA NETWORK
256 kbps.
9. afetr merging the video we can see the whole video in the preview.
10. THE PROBLEM we facing is: in the preview recorded video is disply
clearly, but that inserted video, which we insert to merge with the recording
video, has not diplyed clearly.
11. blurring occrs in the inserted video.
12 we find this blurring clearly in the previewing the whole video.
Expecting from you:
please try to help me, what should i do, to avoid the blurring.
|
|
|
|
|
Sounds like you're using a third party control and should be talking to them.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Hi,
I am currently working on a demo winforms project which has DataGridView control. I have hardcoded the data (using string arrays) & populated in the DataGridView control.
The DataGridView has first column that contains checkbox.
For deleting, I have taken button control & user needs to check the checkboxes to select the rows & then press delete button.
I have found that when first two rows are selected & then delete button is pressed, only first row gets deleted. Also, I am not able to delete any two consecutive rows properly.
I think when a row is deleted, the index of the remaining rows gets changed & this seems to be the problem. But I am not able to find any solution for the same.
Can any one help me for the same? The code for delete button click is as follows:
<code> private void btnDelete_Click(object sender, EventArgs e)
{
int rowCount = 0;
for (int counter = 0; counter < dgDemoGrid.Rows.Count; counter++)
{
if ((bool)dgDemoGrid.Rows[counter].Cells["colSelect"].FormattedValue)
{
rowCount++;
}
}
if (rowCount > 0)
{
DialogResult response = MessageBox.Show("Are you sure you want to delete selected row(s)?",
"Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (response == DialogResult.Yes)
{
for (int counter = 0; counter < dgDemoGrid.Rows.Count; counter++)
{
if ((bool)dgDemoGrid.Rows[counter].Cells["colSelect"].FormattedValue)
{
dgDemoGrid.Rows.Remove(dgDemoGrid.Rows[counter]);
}
}
}
}
else
{
MessageBox.Show("Please select row(s) to delete", "Delete Row(s)", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
</code>
HR
|
|
|
|
|
Change your counter to go backwards when doing the remove, then the relative position remains the same, i.e. don't start at zero and add, start at dgDemoGrid.Rows.Count and subtract.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks to response,
I want close the parent window immediatly, when i open the child window using windows application. Please help me to solve this problem ASAP.
|
|
|
|
|
Declare a delegate on your child form, let parent form hook on this delegate instance. When child form's load finishes, invoke this delegate. Parent form will get notification and in the event handler close it.
|
|
|
|
|
Hi,
I've made a Web Crawler in C#.Net and it crawls a given url in the textbox for all the url's on the page and stores in database.
Then taking one url at a time it again crawls all the urls for email addresses on the contact page of the website.
Now what i want is that when i open my web browser and open google.com search for anything and the results which come out, i mean it gives all the links n urls so i want my tool to work there.
I want my web crawler to work with the google.com results... right now i'm manually providing one url in the textbox for the whole crawling procedures.
I hope i can get good advice and suggestion to solve my problem.
Thanks
Paritosh Tripathi
B.Tech. (C.S.)
|
|
|
|
|
If you look at how google forms the search URL, you can do this. You can form a URL for a search criteria and supply that URL to your crawler.
|
|
|
|
|
Hi Guys,
I am populating a treeview. I am able to populate the initial treenodes correctly with LicenseGroupID and Name ...BUT now I have to populate the childnodes according to the Parent node. The code below is populating all the DataitemID and Name in all the LicenseGroupID ,Instead of only the one which belong to that license Group ID ...
For example
If there is a licenseGroupID = 0 and its name is Everything now it should only display DataitemID and Name which belong to the LicenseGroupID...while right now its fillling up the childnode with all the DataitemID
foreach (DataRow row in treeViewlicencegrpID().Rows)///////Able to populate treeview with [ LicensegroupID ]+ Name
{
int LicensegrpID = 0;
LicensegrpID = (int)row["LicensegroupID"];
TreeNode newnode = new TreeNode();
foreach (DataRow rowchild in getLicDataMap().Rows)//////GetLicDataMap() conatins a string cmd seen below
{
TreeNode childnode = new TreeNode();
childnode.Text = "[" + rowchild["DataitemID"].ToString() + "] " + rowchild["Name"].ToString();
childnode.Tag = (int)rowchild["DataitemID"];
//childnode
newnode.Nodes.Add(childnode);
//break;
}
newnode.Text = "[" + row["LicenseGroupID"].ToString() + "] " + row["Name"].ToString();
newnode.Tag = (int)row["LicensegroupID"];
treeLicencegrpView.Nodes[0].Nodes.Add(newnode);
}
/////GetLicDataMap()
SELECT REVERSE(LocalNamespaceReversed) + c.LocalName as 'Name',a.DataItemID AS DataItemID FROM
webqa_state.dbo.METADATA_Data_Items_LicenseGroups a INNER JOIN
webqa_state.dbo.METADATA_Data_Items_English b ON a.dataItemID = b.dataItemID INNER JOIN
webqa_state.dbo.METADATA_LicenseGroups d ON d.LicenseGroupID = a.LicenseGroupID INNER JOIN
webqa_state.dbo.METADATA_Functions_English_Flat c ON c.BaseDataItemCode = b.localName
ORDER BY REVERSE(LocalNamespaceReversed), c.LocalName ASC
///////
OUTPUT
TF.CompanyCountryCode 13289
TF.CompanyCountryName 13290
TF.CompanyName 13288
TF.CompanyPermID 13287
///////////// LicensegroupID
SELECT Name,LicenseGroupID FROM webqa_state.dbo.METADATA_LicenseGroups
Everything 0
Filings-SECFilingsAll 1000
Filings-GlobalFilingsAll 1001
Financial-ExtelAsReportedFinancials 1002
Please If you can let me know how to go about it Thanks
|
|
|
|
|
I am data binding a DataGridView to a BindingList<t> where the type of the list's items "T" is an interface. Ex:
public class TowerList : BindingList< ITower >
The "ITower" interface descends from a base interface called "IModule" which has two properties, "PartNumber" & "PartDescription".
public interface IModule
{
string PartNumber { get; }
string PartDescription{ get; }
}
public interface ITower : IModule
{
double Height { get; }
}
When I data bind a TowerList object to a DataGridView, and set the "DataPropertyName" of a column to "PartNumber" or "PartDescription", it seems that the data binding mechanism does NOT see the "PartNumber" and "PartDescription" properties which are inherited from the base "IModule" interface. The result is that the part number and part description strings do not show up in the grid.
If I "redeclare" the "PartNumber" and "PartDescription" properties directly in the "ITower" interface itself, then the data binding works and the part number and part description strings show up in the grid. Here is the new "ITower" interface:
public interface ITower : IModule
{
double Height { get; }
new string PartNumber { get; }
new string PartDescription{ get; }
}
I know that if the list contained a set of regular object references (such as a "Tower" object) and not a list of "ITower" interfaces that the data binding would work and the inherited "PartNumber" and "PartDescription" properties would been "seen" by the data binding infrastructure. But.... I'm not sure why the "PartNumber" and "PartDescription" properties are not seen when the items in the list are interfaces. Any advice? Thank you for your help. Joby
|
|
|
|
|
Any chance the IModule was in a different assembly? I seems to encountered a similar situation before.
|
|
|
|
|
Thanks for your response, but no the ITower and IModule interfaces are in the same module. One thing that is different is that the TowerList class and the ITower interface ARE in different modules. I have all my common interfaces in a module that is used by many other modules, and I have a separate "business objects" module that contains the actual Tower class and TowerList class which use the ITower interface. Do you think that would make a difference? It doesn't seem like it should, but you never know. Thanks again.
|
|
|
|
|
I'm running into the exact same situation... have you had any luck finding a solution, yet?
|
|
|
|
|
The only solution that I found was to redeclare the "PartNumber" and "PartDescription" properties in ALL of the descendant interfaces. So all of my interfaces that descend from my base interface "IModule" look like the following:
public interface ITower : IModule
{
new string PartNumber { get; }
new string PartDescription { get; }
}
This is at best a lame "solution" and is clumsy, but I was not able to track down the root cause and create a proper implementation. For my situation, I have all of my interfaces in a single file, so redeclaring these two properties in each descendant interface isn't too much work. It is still a pain, and I hate this kind of code, but it was a relatively easy fix.
If you find a "real" solution, would you please post it here also. I would love to get rid of this code. Thank you. Joby
|
|
|
|
|
Joby,
I think I have a solution that is at least a little more elegant than your current...
Given your interfaces described above, I changed the TowerList to use Generics:
public class TowerList<T> : BindingList<T> where T: ITower
{
}
Then I created a Tower class which implements ITower. Because the Interface is simply a contract, the Tower class must implement each member. For the sake of testing, I just dumped in random values into the properties so something would show up on the grid:
public class Tower : ITower
{
#region ITower Members
private double _height;
public double Height { get { return _height; } }
#endregion
#region IModule Members
private string _partNumber;
private string _partDescription;
public string PartNumber { get { return _partNumber; } }
public string PartDescription { get { return this.Name + " for part #" + _partNumber; } }
#endregion
public String Name { get; set; }
public Tower()
{
Random rnd = new Random();
_height = rnd.NextDouble() * rnd.Next(400, 500);
_partNumber = "X" + rnd.Next().ToString() + rnd.Next().ToString();
}
Then in a form_load event I created a TowerList object like such:
TowerList<Tower> myTowers = new TowerList<Tower> {
new Tower { Name = "TowerX1" },
new Tower { Name = "TowerY2" }
};
I then set the .Datasource property of my DataGridView control and, voilà, all the inherited properties displayed correctly!
You could also define a Towers class as public class Towers : TowerList<tower></tower> if you wanted to add special behavior to Towers lists.
Unfortunately, I don't have an answer as to why the datagrid does not bind all the inherited properties when we do the code the way you described above (I was able to replicate the behavior, though...).
|
|
|
|
|
Hello. I have a DataGridView that is bound to a DataTable. If the user types in values for all the columns for the first row, then clicks into a column in the second row (empty), and then clicks back into the first row he just typed, then an empty row is added to the DataGridView. I'm guessing that somehow the AddRow function is being called when the user clicks in and out of the empty row. I don't want this to happen. A new row should only be added to the DataGridView if the user types in valid values for all the columns. Does anyone know how to fix this? Thanks.
Justin
|
|
|
|
|
Dear sir,
i am developping windows application in that i am using ftp / web client methods using threads to upload a file, to save a file. so whenever i ckick on the save button the file was saved. for saving the file it takes some time depend on the file size.now i want to cancel the saving process in middle by using the cancel click event.
similarly i have uploading file procedure also. when i click on upload a file then file has uploaded but i want to cancel the upload process in middle by clicking cancel button.
please help me.i have only one line code in cancel button i.e this.close(). this is to close the form. but i want to stop the process in middle also if i click on cancel button.
Regards,
Balaji.V
|
|
|
|
|
Well, it would help to see the code that you want to stop running. Also, you need to use threads, so your UI is responsive. If you do this, one inelegant solution is to kill the thread that is uploading.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
balaji_vbr wrote: using ftp / web client methods using threads to upload a file
If you are using the asynchronous method like UploadFileAsync() , I believe there is a CancelAsync method too which can cancel the operation.
|
|
|
|
|
I was hoping one of you clever people could me a hand...
I have a form with an array of class "myObject" that holds my data and I want to show the array in a ListBox control that will display the Name property. When the user clicks on an item in the list the details of that item are displayed in some TextBox controls. The user can now edit the data when they are done they click a button that will update the array and if needed the display name in the list. or even reflect changes straight into the array
How do I databind my object array like a database table? I've tried reading the MSDN on ListBox Control Overview (Windows Forms) but it isn't very clear/only talks about databases.
Not understanding this small area is really holding back my .NET work
I did find this[^] while I was looking but it only covers using a DataSet from a DB.
Dave Henry
-----------------------------------------
evil mastermind or genius benefactor?
NEVER trust the bunny...
modified on Sunday, July 6, 2008 4:15 PM
|
|
|
|
|
You probably will want to use Collection instead of array for binding to listbox.
1. For the display of object in the listbox, override ToString() to display the value that you want on the listbox.
2. Implement INotifyCollectionChanged and INotifyPropertyChanged.
|
|
|
|
|
I forgot to say that I'm using .NET 2.0
Also what do you mean a collection? something like List<myObject>> ?
I'm using the array object because I know that I can easily serialize the array to/from a file.
Dave Henry
-----------------------------------------
evil mastermind or genius benefactor?
NEVER trust the bunny...
|
|
|
|
|
Collection is in .NET since at least 1.1.
You can probably use List<t> for the same purpose though I have not tried that before.
CollectionBase[^]
|
|
|
|
|
either way I still don't know how to data bind the Array/List/Collection to my list box displaying the name property and allow edits from my TextBoxes
public class myObject
{
public string Name;
public string Company;
public string Title;
public string Phone;
}
In the form:-
private myObject[] bodList = new myObject[5]();
I want an GUI that looks like this[^], the same functionality just using my object and NOT a DB connection.
Dave Henry
-----------------------------------------
evil mastermind or genius benefactor?
NEVER trust the bunny...
|
|
|
|