C#Snippets

How to mask the Password text in Textboxes (Textboxes içindeki parola metinini gizlemek.)

5. October 2009

Merhaba  arkadaşlar bu örnek makkale  sizlere c# bir textbox  yazilan paraloyı nasıl gizleriz onu gösterecegim 

Bu maske için karakterleri bir metin kutusuna PasswordChar ayarı  tarafından girilen basit bir işlemdir.

The same can be done using C# code as shown below: Aşağıda gösterildiği gibi aynı C # kodu kullanarak yapılabilir:

TextBox2.PasswordChar = "*" TextBox2.PasswordChar = "*"

 


Metin Kutusu Maske olmadan

 


PasswordChar Property in TextBox PasswordChar TextBox içinde eklemek

 


Evet arkadaşlar c# bir text içine girilen  bir degeri şifre şeklinde nasıl  gösteririz  gördük  tekrar yeni makkalede görüşmek üzere herkeze iyi calışmalar

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C#Snippets

C# CreateSqlServerConnection Snippets

11. June 2009
<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Create a Server based SQLConnection to SQL Server</Title>
      <Author>Microsoft Corporation</Author>
      <Description>Creates a SQL Connection providing replacements for the typical connection name/value pairs.  For this code snippet to compile, add a reference to System.Data.dll and System.Xml.dll.</Description>
      <Shortcut>adoCreateSqlConn</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>conn</ID>
          <Type>SqlConnection</Type>
          <ToolTip>Replace this with the name of the connection object.</ToolTip>
          <Default>conn</Default>
        </Literal>
        <Literal>
          <ID>serverName</ID>
          <Type>String</Type>
          <ToolTip>Replace this with the name of the server.</ToolTip>
          <Default>ServerName</Default>
        </Literal>
        <Literal>
          <ID>dataBaseName</ID>
          <Type>String</Type>
          <ToolTip>Replace this with the name of the database.</ToolTip>
          <Default>Northwind</Default>
        </Literal>
        <Literal>
          <ID>userId</ID>
          <Type>String</Type>
          <ToolTip>Replace this with the user name for connectivity to the database.</ToolTip>
          <Default>&lt;user name&gt;</Default>
        </Literal>
        <Literal>
          <ID>password</ID>
          <Type>String</Type>
          <ToolTip>Replace with the password that corresponds to your user name</ToolTip>
          <Default>&lt;your password&gt;</Default>
        </Literal>
        <Literal Editable="false">
          <ID>SqlConnectionClass</ID>
          <Function>SimpleTypeName(System.Data.SqlClient.SqlConnection)</Function>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[$SqlConnectionClass$ $conn$ = new $SqlConnectionClass$();
        $conn$.ConnectionString = @"Data Source=$serverName$;Initial Catalog=$dataBaseName$;Persist Security Info=True;User ID=$userId$;Password=$password$";$end$]]>        
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C# , C#Snippets

C# ChangeDBLogoninaCrystalReportandSubreports Snippets

11. June 2009
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Change the Server name and Database name</Title>
            <Author>Business Objects</Author>
            <Description>Changes a Server name and Database name used by the report.  For this code snippet to compile, add a reference to CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll.</Description>
            <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
            <Shortcut>crChangeDBLogon</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>FileName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the name of the report file that you want to change the database logon.</ToolTip>
                    <Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
                </Literal>
                <Literal>
                    <ID>OldServerName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the old server name that is used in the report. </ToolTip>
                    <Default>"OldServer"</Default>
                </Literal>
                <Literal>
                    <ID>NewServerName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the new server name that the report will be using. </ToolTip>
                    <Default>"NewServer"</Default>
                </Literal>
                <Literal>
                    <ID>OldDatabaseName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the old database name that is used in the report. </ToolTip>
                    <Default>"OldDatabase"</Default>
                </Literal>
                <Literal>
                    <ID>NewDatabaseName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the new database name that the report will be using. </ToolTip>
                    <Default>"NewDatabase"</Default>
                </Literal>
                <Literal>
                    <ID>UserID</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the user ID to logon to the new server. </ToolTip>
                    <Default>"MyUserID"</Default>
                </Literal>
                <Literal>
                    <ID>Password</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the user's password to logon to the new server. </ToolTip>
                    <Default>"MyPassword"</Default>
                </Literal>
        <Literal Editable="false">
          <ID>ReportDocumentClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>IConnectionInfoClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.IConnectionInfo)</Function>
        </Literal>        
            </Declarations>
            <Code Language="csharp">
        <![CDATA[$ReportDocumentClass$ report = new $ReportDocumentClass$();          
          string oldServerName = $OldServerName$;
          string newServerName = $NewServerName$;
          string oldDatabaseName = $OldDatabaseName$;
          string newDatabaseName = $NewDatabaseName$;
          string userID = $UserID$;
          string password = $Password$;
          
          report.Load(@$FileName$);
          
          // Change the server name and database in main reports          
          foreach($IConnectionInfoClass$ connection in report.DataSourceConnections)
          {
            if ((String.Compare(connection.ServerName, oldServerName, true) == 0) &&
              (String.Compare(connection.DatabaseName, oldDatabaseName, true) == 0))
            {
              // SetConnection can also be used to set new logon and new database table
              report.DataSourceConnections[oldServerName, oldDatabaseName].SetConnection(
                newServerName, newDatabaseName, userID, password);
            }
          }     
          
          // Change the server name and database in subreport
          foreach($ReportDocumentClass$ subReport in report.Subreports)
          {
            foreach($IConnectionInfoClass$ connection in subReport.DataSourceConnections)
            {
              if ((String.Compare(connection.ServerName, oldServerName, true) == 0) &&
                (String.Compare(connection.DatabaseName, oldDatabaseName, true) == 0))
              {
                // SetConnection can also be used to set new logon and new database table
                subReport.DataSourceConnections[oldServerName, oldDatabaseName].SetConnection(
                  newServerName, newDatabaseName, userID, password);
              }
            }
          }$end$]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C# , C#Snippets

C# ExportaCrystalReporttoFile Snippets

11. June 2009
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Export a Crystal Report to a file</Title>
      <Author>Business Objects</Author>
      <Description>The following code example exports a Crystal Report to a file.  For this code snippet to compile, add a reference to CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll.</Description>
      <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
      <Shortcut>crExportRptToDisk</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>FileName</ID>
          <ToolTip>Replace this string with the name of the report file you want to export from.</ToolTip>
          <Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
        </Literal>
        <Literal>
          <ID>ExportFormatType</ID>
          <ToolTip>Replace this value with the export format Type that you want to export the report to.</ToolTip>
          <Default>PortableDocFormat</Default>
        </Literal>
        <Literal>
          <ID>DestinationFileName</ID>
          <ToolTip>Replace this string with the file name you want to export the report to.</ToolTip>
          <Default>"C:\My Crystal Reports\Report Name.pdf"</Default>
        </Literal>
        <Literal Editable="false">
          <ID>ReportDocumentClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>ExportFormatTypeClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.ExportFormatType)</Function>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[// You can change other export options like page range by calling Export method with an ExportOptions object.
                $ReportDocumentClass$ report = new $ReportDocumentClass$();
                report.Load(@$FileName$);
                report.ExportToDisk($ExportFormatTypeClass$.$ExportFormatType$, @$DestinationFileName$);
                report.Close();$end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C# , C#Snippets

C# ExportaCrystalReporttoFilewithCustomOptions Snippets

11. June 2009
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Export a Crystal Report to a PDF file with custom export format options</Title>
      <Author>Business Objects</Author>
      <Description>The following code example exports a Crystal Report to a PDF file with custom export format options.  For this code snippet to compile, add a reference to CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll.</Description>
      <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
      <Shortcut>crExportRptWithOptions</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>FileName</ID>
          <ToolTip>Replace this string with the name of the report file you want to export from.</ToolTip>
          <Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
        </Literal>
        <Literal>
          <ID>DestinationFileName</ID>
          <ToolTip>Replace this string with the file name you want to export the report to.</ToolTip>
          <Default>"C:\My Crystal Reports\Report Name.pdf"</Default>
        </Literal>
        <Literal>
          <ID>usePageRange</ID>
          <ToolTip>Set this boolean to true if the FirstPageNumber and LastPageNumber should be used.</ToolTip>
          <Default>true</Default>
        </Literal>
        <Literal>
          <ID>startPage</ID>
          <ToolTip>Replace this number with the first page number to print; use 0 to specify whole report.</ToolTip>
          <Default>1</Default>
        </Literal>
        <Literal>
          <ID>endPage</ID>
          <ToolTip>Replace this number with the last page number to print; use 0 to specify whole report.</ToolTip>
          <Default>5</Default>
        </Literal>
        <Literal Editable="false">
          <ID>ReportDocumentClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>ExportOptionsClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.ExportOptions)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>ExportDestinationTypeClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.ExportDestinationType)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>ExportFormatTypeClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.ExportFormatType)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>PdfRtfWordFormatOptionsClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.PdfRtfWordFormatOptions)</Function>
        </Literal>
        <Literal Editable="false">
          <ID>DiskFileDestinationOptionsClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.Shared.DiskFileDestinationOptions)</Function>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[$ReportDocumentClass$ report = new $ReportDocumentClass$();
$ExportOptionsClass$ exportOptions = new $ExportOptionsClass$();
$PdfRtfWordFormatOptionsClass$ pdfExportFormatOptions = new $PdfRtfWordFormatOptionsClass$();
$DiskFileDestinationOptionsClass$ diskDestinationOptions = new $DiskFileDestinationOptionsClass$();

// Set the export format and format options

exportOptions.ExportFormatType = $ExportFormatTypeClass$.PortableDocFormat;
pdfExportFormatOptions.FirstPageNumber = $startPage$;
pdfExportFormatOptions.LastPageNumber = $endPage$;
pdfExportFormatOptions.UsePageRange = $usePageRange$;
exportOptions.ExportFormatOptions = pdfExportFormatOptions;

// Set the disk file options.

exportOptions.ExportDestinationType = $ExportDestinationTypeClass$.DiskFile;
diskDestinationOptions.DiskFileName = @$DestinationFileName$;
exportOptions.DestinationOptions = diskDestinationOptions;

report.Load(@$FileName$);
report.Export(exportOptions);
report.Close();$end$]]>
                </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C# , C#Snippets

C# PrintaCrystalReport Snippets

11. June 2009
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Print a Crystal Report </Title>
      <Author>Business Objects</Author>
      <Description>The following code example prints a Crystal Report to the printer specified in the PrintOptions.  For this code snippet to compile, add a reference to CrystalDecisions.CrystalReports.Engine.dll and CrystalDecisions.Shared.dll.</Description>
      <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
      <Shortcut>crPrintRpt</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>FileName</ID>
          <ToolTip>Replace this string with the name of the report file you want to print.</ToolTip>
          <Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
        </Literal>
        <Literal>
          <ID>copies</ID>
          <ToolTip>Replace this number with the number of copies of Crystal Report you want to print.</ToolTip>
          <Default>1</Default>
        </Literal>
        <Literal>
          <ID>collated</ID>
          <ToolTip>Replace this boolean with false if you do not want to print the Crystal Report collated.</ToolTip>
          <Default>true</Default>
        </Literal>
        <Literal>
          <ID>startPage</ID>
          <ToolTip>Replace this number with the first page number to print; use 0 to specify whole report.</ToolTip>
          <Default>0</Default>
        </Literal>
        <Literal>
          <ID>endPage</ID>
          <ToolTip>Replace this number with the last page number to print; use 0 to specify whole report.</ToolTip>
          <Default>0</Default>
        </Literal>
        <Literal Editable="false">
          <ID>ReportDocumentClass</ID>
          <Function>SimpleTypeName(CrystalDecisions.CrystalReports.Engine.ReportDocument)</Function>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[// You can change more print options via PrintOptions property of ReportDocument
               $ReportDocumentClass$ report = new $ReportDocumentClass$();
               report.Load(@$FileName$);
               report.PrintToPrinter($copies$, $collated$, $startPage$, $endPage$);
               report.Close();$end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C# , C#Snippets