?
Solved

Vb code in C#

Posted on 2009-04-08
4
Medium Priority
?
1,246 Views
Last Modified: 2013-12-17
Hi experts,
I m a real fresher so I am seeking your help in this.
I tried VB.net to C# converter.But it is also not working for me.
I am having following code in VB,I just need it in C#.
Thanks in advance.
Private Sub FormatSpread()
 
With FpSpread1.Sheets(0)
 
.ColumnHeader.Rows(0).Height = 30
 
.Columns(0).Visible = False
 
End With
 
End Sub
 
 
 
Private Sub FpSpread1_ChildViewCreated(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.ChildViewCreatedEventArgs) Handles FpSpread1.ChildViewCreated 
 
Dim dateType As New FarPoint.Win.Spread.CellType.DateTimeCellType()
 
 
If e.SheetView.ParentRelationName = "Root" Then
 
With e.SheetView
 
.DataAutoCellTypes = False
 
.DataAutoSizeColumns = False
 
.ColumnHeader.Rows(0).Height = 30
 
.Columns(0).Visible = False
 
.Columns(3).Visible = False
 
.Columns(4).Visible = False
 
.Columns(1).Width = 200
 
.Columns(2).Width = 185
 
.Columns(6).Width = 85
 
.Columns(7).Width = 80
 
.Columns(8).Width = 80
 
.Columns(5).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType()
 
.Columns(7).CellType = New FarPoint.Win.Spread.CellType.CheckBoxCellType()
 
End With
 
Else
 
With e.SheetView
 
.DataAutoCellTypes = False
 
.DataAutoSizeColumns = False
 
.ColumnHeader.Rows(0).Height = 30
 
.Columns(0).Visible = False
 
.Columns(2).Visible = False
 
.Columns(3).Visible = False
 
.Columns(4).Visible = False
 
.Columns(7).Visible = False
 
.Columns(8).Visible = False
 
.Columns(9).Visible = False
 
.Columns(1).Width = 100
 
.Columns(6).Width = 80
 
.Columns(5).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType()
 
dateType.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate
 
.Columns(1).CellType = dateType
 
'Add a total column
 
.ColumnCount = .ColumnCount + 1
 
.ColumnHeader.Cells(0, .ColumnCount - 1).Value = "Total" 
 
.Columns(.ColumnCount - 1).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType()
 
.Columns(.ColumnCount - 1).Formula = "F1*G1"
 
End With
 
End If
 
End Sub

Open in new window

0
Comment
Question by:johny_bravo1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 6

Accepted Solution

by:
HarryNS earned 800 total points
ID: 24095231

private void FormatSpread()
    {
        FpSpread1.Sheets(0).ColumnHeader.Rows(0).Height = 30;
        FpSpread1.Sheets(0).Columns(0).Visible = False;
    }
 
    private void FpSpread1_ChildViewCreated(Object sender, FarPoint.Win.Spread.ChildViewCreatedEventArgs e)
    {
        FarPoint.Win.Spread.CellType.DateTimeCellType dateType = new FarPoint.Win.Spread.CellType.DateTimeCellType();
 
 
        if (e.SheetView.ParentRelationName = "Root")
        {
            e.SheetView.DataAutoCellTypes = False;
            e.SheetView.DataAutoSizeColumns = False;
            e.SheetView.ColumnHeader.Rows(0).Height = 30;
            e.SheetView.Columns(0).Visible = False;
            e.SheetView.Columns(3).Visible = False;
            e.SheetView.Columns(4).Visible = False;
            e.SheetView.Columns(1).Width = 200;
            e.SheetView.Columns(2).Width = 185;
            e.SheetView.Columns(6).Width = 85;
            e.SheetView.Columns(7).Width = 80;
            e.SheetView.Columns(8).Width = 80;
            e.SheetView.Columns(5).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
            e.SheetView.Columns(7).CellType = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
        }
        else
        {
            e.SheetView.DataAutoCellTypes = False;
            e.SheetView.DataAutoSizeColumns = False;
            e.SheetView.ColumnHeader.Rows(0).Height = 30;
            e.SheetView.Columns(0).Visible = False;
            e.SheetView.Columns(2).Visible = False;
            e.SheetView.Columns(3).Visible = False;
            e.SheetView.Columns(4).Visible = False;
            e.SheetView.Columns(7).Visible = False;
            e.SheetView.Columns(8).Visible = False;
            e.SheetView.Columns(9).Visible = False;
            e.SheetView.Columns(1).Width = 100;
            e.SheetView.Columns(6).Width = 80;
            e.SheetView.Columns(5).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
            dateType.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
            e.SheetView.Columns(1).CellType = dateType;
 
            //Add a total column
 
            e.SheetView.ColumnCount = e.SheetView.ColumnCount + 1;
            e.SheetView.ColumnHeader.Cells(0, e.SheetView.ColumnCount - 1).Value = "Total";
            e.SheetView.Columns(e.SheetView.ColumnCount - 1).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
            e.SheetView.Columns(e.SheetView.ColumnCount - 1).Formula = "F1*G1";
        }
    }

Open in new window

0
 
LVL 29

Assisted Solution

by:Gautham Janardhan
Gautham Janardhan earned 600 total points
ID: 24095262

Private void FormatSpread()
{
FpSpread1.Sheets[0].ColumnHeader.Rows(0).Height = 30
 
FpSpread1.Sheets[0].Columns(0).Visible = False
} 
 
 
Private void FpSpread1_ChildViewCreated(Object sender ,FarPoint.Win.Spread.ChildViewCreatedEventArgs e)
{
 
arPoint.Win.Spread.CellType.DateTimeCellType dateType = new FarPoint.Win.Spread.CellType.DateTimeCellType();
 
 
If (e.SheetView.ParentRelationName = "Root")
 {
e.SheetView.DataAutoCellTypes = False;
e.SheetView.DataAutoSizeColumns = False;
e.SheetView.ColumnHeader.Rows(0).Height = 30;
e.SheetView.Columns(0).Visible = False;
e.SheetView.Columns(3).Visible = False;
e.SheetView.Columns(4).Visible = False;
e.SheetView.Columns(1).Width = 200;
e.SheetView.Columns(2).Width = 185;
e.SheetView.Columns(6).Width = 85;
e.SheetView.Columns(7).Width = 80;
e.SheetView.Columns(8).Width = 80;
e.SheetView.Columns(5).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType();
e.SheetView.Columns(7).CellType = New FarPoint.Win.Spread.CellType.CheckBoxCellType();
 }
Else
 { 
e.SheetView.DataAutoCellTypes = False;
e.SheetView.DataAutoSizeColumns = False;
e.SheetView.ColumnHeader.Rows(0).Height = 30;
e.SheetView.Columns(0).Visible = False;
e.SheetView.Columns(2).Visible = False;;
e.SheetView.Columns(3).Visible = False;
e.SheetView.Columns(4).Visible = False;
e.SheetView.Columns(7).Visible = False;
e.SheetView.Columns(8).Visible = False;
e.SheetView.Columns(9).Visible = False;
e.SheetView.Columns(1).Width = 100;
e.SheetView.Columns(6).Width = 80;
 
e.SheetView.Columns(5).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType();
 
dateType.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
 
e.SheetView.Columns(1).CellType = dateType;
 
//Add a total column
 
e.SheetView.ColumnCount = e.SheetView.ColumnCount + 1;
 
e.SheetView.ColumnHeader.Cells[0, .ColumnCount - 1].Value = "Total" ;
 
e.SheetView.Columns(.ColumnCount - 1).CellType = New FarPoint.Win.Spread.CellType.CurrencyCellType();
 
e.SheetView.Columns(e.SheetView.ColumnCount - 1).Formula = "F1*G1"
 
} 
}

Open in new window

0
 
LVL 9

Assisted Solution

by:Sreedhar Vengala
Sreedhar Vengala earned 600 total points
ID: 24095263
try with http://www.developerfusion.com/tools/convert/vb-to-csharp/

private void FormatSpread()
{
    {
        FpSpread1.Sheets(0).ColumnHeader.Rows(0).Height = 30;
       
        FpSpread1.Sheets(0).Columns(0).Visible = false;
       
       
    }
}



private void FpSpread1_ChildViewCreated(object sender, FarPoint.Win.Spread.ChildViewCreatedEventArgs e)
{
   
    FarPoint.Win.Spread.CellType.DateTimeCellType dateType = new FarPoint.Win.Spread.CellType.DateTimeCellType();
   
   
    if (e.SheetView.ParentRelationName == "Root") {
       
        {
           
            e.SheetView.DataAutoCellTypes = false;
           
            e.SheetView.DataAutoSizeColumns = false;
           
            e.SheetView.ColumnHeader.Rows(0).Height = 30;
           
            e.SheetView.Columns(0).Visible = false;
           
            e.SheetView.Columns(3).Visible = false;
           
            e.SheetView.Columns(4).Visible = false;
           
            e.SheetView.Columns(1).Width = 200;
           
            e.SheetView.Columns(2).Width = 185;
           
            e.SheetView.Columns(6).Width = 85;
           
            e.SheetView.Columns(7).Width = 80;
           
            e.SheetView.Columns(8).Width = 80;
           
            e.SheetView.Columns(5).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
           
            e.SheetView.Columns(7).CellType = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
           
        }
    }
    else {
       
       
        {
           
            e.SheetView.DataAutoCellTypes = false;
           
            e.SheetView.DataAutoSizeColumns = false;
           
            e.SheetView.ColumnHeader.Rows(0).Height = 30;
           
            e.SheetView.Columns(0).Visible = false;
           
            e.SheetView.Columns(2).Visible = false;
           
            e.SheetView.Columns(3).Visible = false;
           
            e.SheetView.Columns(4).Visible = false;
           
            e.SheetView.Columns(7).Visible = false;
           
            e.SheetView.Columns(8).Visible = false;
           
            e.SheetView.Columns(9).Visible = false;
           
            e.SheetView.Columns(1).Width = 100;
           
            e.SheetView.Columns(6).Width = 80;
           
            e.SheetView.Columns(5).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
           
            dateType.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
           
            e.SheetView.Columns(1).CellType = dateType;
           
            //Add a total column
           
            e.SheetView.ColumnCount = e.SheetView.ColumnCount + 1;
           
            e.SheetView.ColumnHeader.Cells(0, e.SheetView.ColumnCount - 1).Value = "Total";
           
            e.SheetView.Columns(e.SheetView.ColumnCount - 1).CellType = new FarPoint.Win.Spread.CellType.CurrencyCellType();
           
            e.SheetView.Columns(e.SheetView.ColumnCount - 1).Formula = "F1*G1";
           
        }
    }
       
   
}
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24095299
Thank you experts,
all of your code is working with very little modifications such as replacing ( with [
.
Has anyone of you used farpoint.I need to display hierarchical data in farpoint as shown in the example
http://www.clubfarpoint.com/FarPointSupportSite/Modules/Docs/SpreadWin4.0/spwin-databind-hierarchy.html

If you can guide me in this,it would be great
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question