Click here to Skip to main content
15,886,578 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# string.IsNullOrEmpty Pin
Matt T Heffron1-Jun-16 9:25
professionalMatt T Heffron1-Jun-16 9:25 
GeneralRe: c# string.IsNullOrEmpty Pin
aspkiddy2-Jun-16 5:12
aspkiddy2-Jun-16 5:12 
AnswerRe: c# string.IsNullOrEmpty Pin
Matt T Heffron2-Jun-16 6:20
professionalMatt T Heffron2-Jun-16 6:20 
QuestionDo I Need The Observer Design Pattern In My Situation Pin
MadDashCoder31-May-16 6:12
MadDashCoder31-May-16 6:12 
AnswerRe: Do I Need The Observer Design Pattern In My Situation Pin
Eddy Vluggen31-May-16 19:42
professionalEddy Vluggen31-May-16 19:42 
GeneralRe: Do I Need The Observer Design Pattern In My Situation Pin
MadDashCoder1-Jun-16 0:51
MadDashCoder1-Jun-16 0:51 
GeneralRe: Do I Need The Observer Design Pattern In My Situation Pin
Eddy Vluggen1-Jun-16 0:57
professionalEddy Vluggen1-Jun-16 0:57 
QuestionBack and Forward button for MDI Parent Pin
Rashad Hameed31-May-16 1:26
Rashad Hameed31-May-16 1:26 
VB.NET
Private Sub BACKToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BACKToolStripMenuItem.Click
        Try
            Dim t As New Form
            For Each f As Form In Application.OpenForms
                If f IsNot Me.ActiveMdiChild Then
                    t = f
                Else
                    t.Activate()
                    Return
                End If
            Next
        Catch ex As Exception
            System.Windows.Forms.MessageBox.Show(ex.Message, "Error...!!!", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Private Sub FORWARDToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FORWARDToolStripMenuItem.Click
        Try
            Dim t As New Form
            For i As Integer = Application.OpenForms.Count - 1 To 0 Step -1
                Dim f As Form = Application.OpenForms(i)
                If f IsNot Me.ActiveMdiChild Then
                    t = f
                Else
                    t.Activate()
                    Return
                End If
            Next
        Catch ex As Exception
            System.Windows.Forms.MessageBox.Show(ex.Message, "Error...!!!", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub




i converted this code to c#


C#
private void BACKToolStripMenuItem_Click(System.Object sender, System.EventArgs e)
{
	try {
		Form t = new Form();
		foreach (Form f in Application.OpenForms) {
			if (!object.ReferenceEquals(f, this.ActiveMdiChild)) {
				t = f;
			} else {
				t.Activate();
				return;
			}
		}
	} catch (Exception ex) {
		System.Windows.Forms.MessageBox.Show(ex.Message, "Error...!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
	}
}

private void FORWARDToolStripMenuItem_Click(System.Object sender, System.EventArgs e)
{
	try {
		Form t = new Form();
		for (int i = Application.OpenForms.Count - 1; i >= 0; i += -1) {
			Form f = Application.OpenForms(i);
			if (!object.ReferenceEquals(f, this.ActiveMdiChild)) {
				t = f;
			} else {
				t.Activate();
				return;
			}
		}
	} catch (Exception ex) {
		System.Windows.Forms.MessageBox.Show(ex.Message, "Error...!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
	}
}



can anyone tell me whats is the error in
Form f = Application.OpenForms(i);

backward is working forward is not working help me plz
AnswerRe: Back and Forward button for MDI Parent Pin
OriginalGriff31-May-16 3:00
mveOriginalGriff31-May-16 3:00 
GeneralRe: Back and Forward button for MDI Parent Pin
Rashad Hameed31-May-16 11:14
Rashad Hameed31-May-16 11:14 
GeneralRe: Back and Forward button for MDI Parent Pin
OriginalGriff31-May-16 11:37
mveOriginalGriff31-May-16 11:37 
AnswerRe: Back and Forward button for MDI Parent Pin
Brisingr Aerowing31-May-16 3:00
professionalBrisingr Aerowing31-May-16 3:00 
AnswerRe: Back and Forward button for MDI Parent Pin
BillWoodruff31-May-16 3:36
professionalBillWoodruff31-May-16 3:36 
QuestionVisual Studio 2005 Web Application Problem Pin
Zeyad Jalil31-May-16 0:07
professionalZeyad Jalil31-May-16 0:07 
AnswerRe: Visual Studio 2005 Web Application Problem Pin
Dave Kreskowiak31-May-16 3:45
mveDave Kreskowiak31-May-16 3:45 
QuestionScrape a controls which doesn't have any handle in windows application Pin
Member 1101883830-May-16 23:55
Member 1101883830-May-16 23:55 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
OriginalGriff30-May-16 23:59
mveOriginalGriff30-May-16 23:59 
GeneralRe: Scrape a controls which doesn't have any handle in windows application Pin
BillWoodruff31-May-16 3:38
professionalBillWoodruff31-May-16 3:38 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Gerry Schmitz31-May-16 5:21
mveGerry Schmitz31-May-16 5:21 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Eddy Vluggen31-May-16 5:32
professionalEddy Vluggen31-May-16 5:32 
AnswerRe: Scrape a controls which doesn't have any handle in windows application Pin
Bernhard Hiller1-Jun-16 0:03
Bernhard Hiller1-Jun-16 0:03 
QuestionConnection String using by ini file or TextFile Pin
Mostafa_Hosseini30-May-16 22:18
Mostafa_Hosseini30-May-16 22:18 
AnswerRe: Connection String using by ini file or TextFile Pin
OriginalGriff30-May-16 22:42
mveOriginalGriff30-May-16 22:42 
GeneralRe: Connection String using by ini file or TextFile Pin
Mostafa_Hosseini31-May-16 4:34
Mostafa_Hosseini31-May-16 4:34 
GeneralRe: Connection String using by ini file or TextFile Pin
OriginalGriff31-May-16 4:46
mveOriginalGriff31-May-16 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.