4
Answers

Problem with loops

Photo of darma teja

darma teja

12y
891
1
Hi,

I have a different numbers in a datagridview.

Now my problem here is:

I want to write code into button click event. Once button is clicked i should show  message boxes. The no of message boxes depends on the numbers in datagrid view.

for example i have 50 numbers in datagridview, i should show 5 message boxes with each 10 numbers.

if i have 60 numbers in a datagridvies, i should  show 6 message boxes with each 10 numbers. 

Everything should happen in one button click.

Please give me ideas to do.


Darma




Answers (4)

0
Deepak Tewatia
14 15.7k 23.1k 1y

Certainly! In .NET technology, checking for exceptions involves employing try-catch blocks to handle potential errors that may occur during the execution of code. Here's a brief overview:


try
{
    // Code that may potentially throw an exception
}
catch (Exception ex)
{
    // Handling the exception, which may involve logging, displaying an error message, or taking corrective action
}

In this example, the code within the try block is monitored for exceptions. If an exception is thrown, the catch block is triggered, allowing you to handle the exception appropriately.

For instance, let's consider a scenario where you attempt to open a file. If the file doesn't exist, an exception is thrown. By using a try-catch block, you can gracefully handle the exception, such as displaying a user-friendly message or initiating an alternative course of action.

I trust this provides the technical insights you were seeking. If you need further elaboration or specific examples, feel free to ask!