|
<br />
namespace WindowsFormsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
private List<Data> dataList = new List<Data>();<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
dataGridView1.DataSource = dataList;<br />
}<br />
<br />
private void addTToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
dataList.Add(new Data() { Name = "V", LastName = "J" });<br />
dataGridView1.DataSource = null;<br />
dataGridView1.DataSource = dataList; <br />
}<br />
<br />
private void FillData()<br />
{<br />
dataList.Add(new Data() { Name = "V", LastName = "J" });<br />
dataList.Add(new Data() { Name = "A", LastName = "B" });<br />
dataList.Add(new Data() { Name = "C", LastName = "D" });<br />
}<br />
}<br />
<br />
public class Data<br />
{<br />
public string Name { get; set; }<br />
public string LastName { get; set; }<br />
}<br />
}<br />
In the above code I try to add a data in the List through gridview by using context menu.
Its working fine if already List is populated by data.
But fails if I try to add a data without the List is populated.
Scenario on fail:
screen 1: Form with empty gridview is shown.
screen 2: I right click the gridview which show the context menu "Add", when I clicks addTToolStripMenuItem_Click method is called. which creates the data and adds in the list.
screen 3: The gridview with the one data is appearing.
scrren 4: When I tried to click on the cell ( i.e, newly created ). The error is getting thrown "IndexOutOfRange" -1.
Is I am missing any propeties to set.
Thanks in advance
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: dataList.Add(new Data() { Name = "V", LastName = "J" });
dataGridView1.DataSource = null;
Hi, I haven't used this, but it seems to me the order of the above lines is wrong;
I would remove the bind, modify, then reinstate the bind.
|
|
|
|
|
Like this,
dataGridView1.DataSource = null;
dataList.Add(new Data() { Name = "V", LastName = "J" });
dataGridView1.DataSource = dataList;
I tried that too, Not working..
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
Hi,
I have a few forms in my C# windows application. On main form, by a button, another form is shown. On this second form, by a button, another form is shown MODALLY ( ShowDialog() ). In such stiuation, when another application (ex: windows explorer) becomes activated, then my application reactivated using application-icons on windows Task Bar, my Main form appears on top and does not respond to user because another form is shown modally which actually does not appear.
In fact, here, when windwos' Alt-Tab browsing is used, it seems no problem.
How can I ensure the last opened form to bring to front in such cases?
I know it seems a small problem but really bothering..
Thanks for you help
|
|
|
|
|
You can test the following code snippets:
<br />
<br />
private void mnuAbout_Click(object sender, System.EventArgs e)<br />
{<br />
Form f = new Form();<br />
f.ShowDialog(this);<br />
}<br />
<br />
Anindya Chatterjee
|
|
|
|
|
Yes, setting the owner of a dependent form should do it.
|
|
|
|
|
Hi all,
I have a dataset and already bind to one datagridview. I am using DataGridViewRowsRemovedEventHandler to remove row (click on selected row and press delete). After i removed the row, and using loop to display the data in dataset. I get the exception above and the details as below :
This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.
How can i remove the row completely in dataset to avoid this error?
any tips are welcome.
regards
cocoonwls
|
|
|
|
|
I am developing a C# app which will download Rapidshare files for Free users. The program would work as follows:
1. Rapidshare webpage would open in WebBrowser control.
2. Captcha would be input in the webpage
3. File download will occur using the download manager of the app, instead of the default download manager.
I have designed the download section in the following way.
<br />
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)<br />
<br />
{<br />
<br />
string filename = @"C:\test.rar";<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
string match = e.Url.AbsoluteUri;<br />
<br />
if (pattern.IsMatch(match))<br />
<br />
{<br />
<br />
e.Cancel = true;<br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
While running, the app downloads a 10KB file instead of the real one. If I use the followsing code:
<br />
private void rapidWebBrowser_FileDownload(object sender, EventArgs e)<br />
<br />
{<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
if (pattern.IsMatch(match))
<br />
{ <br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
the app downloads a 10KB file and pops up IE's default download manager.
How to solve the problem? I want to intercept the original file download by WebBrowser control, and pass the url to my app's custom downloader suppressing the IE's downloader. How to do this?
I am eagerly waiting for the solution. Thank you in advance.
Anindya Chatterjee
|
|
|
|
|
Have you tried renaming the small file you get and opening it in IE? I believe Rapidshare blocks download accelerators.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I am not at all using any accelerator. I am just using mere WebClient to download. Basically I know that using Http POST Rapidshare transfer files. But how to embed it in my app to intercept the default download manager, I don't know. That is I am searching for.
Anindya Chatterjee
|
|
|
|
|
Apologies, I misread your post. I had tried using a download accelerator once and it failed.
Have you tried downloading the full file and comparing its contents with those of the one your app downloads? I still think it might be useful to rename the file you get to .HTML and open it in your browser.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Has anyone here ever experienced this error message?
The application that gave me this error message works fine on my work computer but throws this exception on my home computer.
|
|
|
|
|
Guess you didn't move a config file, or it points to something that is not present on your home PC
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I zipped up the entire directory containing the solution from my work computer.
The exception stems from a 3rd party dll that resides in the bin/debug directory of the solution.
But like I said, I zipped the solution directory in its entirety and copied it from my work computer and the solution works with no problems on my work computer, although it is failing on my home computer.
I searched Google and there are a lot of results for this error message but I didn't see a clear pattern in regards to what I am working on and I'm not sure where to begin on this one.
|
|
|
|
|
I presume this means the 3rd party DLL is not properly configued/installed. Often on a dev machine, the files go in the GAC and so don't end up in the folder you zip up.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Is that 3rd party DLL a mixed mode DLL? I have seen this error message pop up because the machine did not have the VC side by side DLLs installed. Installing vcredist_x86.exe from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86 should fix that.
|
|
|
|
|
Isn't vcredist_x86.exe specific to C++ development?
This project is written in C#.
|
|
|
|
|
OK - Let me give you some additional information for debugging purposes.
I've tried removing the reference to the problem assembly and then readding the reference. This appears to be the only way to follow the exception instruction message to "reinstall the application."
Also, I have tried downloading a new version of the dll as well as using the dll from my work environment.
On my home computer, I just have VS2008 while on my work computer I have both VS2005 as well as VS2008.
Here is a url to the component:
http://tinyurl.com/6nj22s[^]
Once you have added a reference to the dll you should be able to write the following statement:
>AddressBook addressBook = new AddressBook();
This works for me in my work environment but throws an exception in my home environment.
Please let me know what you find.
modified on Monday, May 5, 2008 11:39 PM
|
|
|
|
|
The code runs fine on my machine.
Did you try running the release version on your home PC? I faced a similar problem - a debug mode C++/CLI DLL built on VS 2005 SP1 did not run on a machine with only VS 2005, but the release mode DLL ran fine.
|
|
|
|
|
The dll is a mixed code module. I'm not sure that is part of the problem.
When you say run the release version - I set the mode to "Release" in the toolbar (instead of the default of "Debug") and I still get the error message.
I even tried referencing the dll from an external directory to see if that made any difference but it did not.
What am I missing?
|
|
|
|
|
When I run the application on my home computer I still get the message "the application configuration is incorrect."
The following message is saved to the System Event log: "Dependent Assembly Microsoft.VC80.DebugCRT could not be found"
I searched the entire "C:\" directory on my work computer (where I do not get the error): There is a directory named "x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c" in
c:\WINDOWS\WinSxS that contains 3 dlls. I copied this folder and the related manifest to my home computer. I also noticed that there is a folder of the same name in the C:\WINDOWS\WinSxS\Policies directory. Should this be copied to my home computer? If so then where?
I tried copying this entire directory as a subdirectory of the directory in which the third-party dll resides on my home computer. I also copied and pasted the dlls from the subdirectory into the parent directory that contains the third-party dll.
There is a folder named "Microsoft.VC80.DebugCRT" in - C:\Program Files\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86. Should this be used instead?
Do I need to create a merge module or use some other approach to copy the directory into a matching location on the user's computer?
So I guess at this point I am not exactly clear on what I need to do and how I need to do it. Any suggestions?
|
|
|
|
|
Member 3919049 wrote: I searched the entire "C:\" directory on my work computer (where I do not get the error): There is a directory named "x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c" in
c:\WINDOWS\WinSxS that contains 3 dlls. I copied this folder and the related manifest to my home computer. I also noticed that there is a folder of the same name in the C:\WINDOWS\WinSxS\Policies directory. Should this be copied to my home computer? If so then where?
AFAIK, copying files into WinSxS doesn't work. The debug CRT is installed when you install Visual Studio, so it won't be available on a machine without VS. And AFAIK, you're not supposed to redistribute the Debug CRT.
The idea is that you do the development on a machine with VS, then generate a release mode version of the code that will run on a machine without VS.
So you're not building the mixed mode DLL then? If you are, then build the DLL in release mode and the problem will go away.
If you are not, check if the DLL has a release mode version - typically, the debug version will have a D appended to the filename. You'll need to reference the release version of the DLL from your project.
|
|
|
|
|
hi!
i have a question. that is we have ha a problem "which one is smaller n pow 2, 1000 pow n, n pow n, n pow 1000 , when n value is nearer to infinite" plz also give reason along with answer
Best Regards,
Huma Satti
|
|
|
|
|
Double Post and incorrect forum.
Giorgi Dalakishvili
#region signature
my articles
#endregion
modified on Monday, May 5, 2008 3:11 AM
|
|
|
|
|
I suggest you do your own homework. I guess you are posting this here because you've been asked to use C# to prove your answer ? How is that not trivial ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|