Convert Doc file to PDF,XPS,SVG,XML,HTML using Spire in C#

How to convert Document file to Convert Word to PDF,HTML,Image,XML and XPS in C#.Net without Word Automation


There are many useful libraries around Nuget which can be made your application more productive. We already learned how to create PDF files from a Word Document using Interop and Docx.

Free Spire.Doc offer high performance operation on word documents. You can check the project on Codeplex Achive

Spire offer following feature

  • *Convert Word to PDF
  • *Convert Word to HTML
  • *Convert Word to Image
  • *Convert Word to XML
  • *Convert Word to RTF
  • *Convert Word to EMF
  • *Convert Word to XPS

How to Convert Doc to PDF

Add the library to your project using Nuget Package Manager

Visual Studio 2019 : Nuget Package Manager

How to create ListView with CustomAdapter in Android Studio


Default ListView layout let you display single piece of information while a customised list view layout let you design your own components. All you need is a separate layout file

1

and a adaptor which extends BaseAdpter or ArrayAdapter. Continue reading “How to create ListView with CustomAdapter in Android Studio”

How to Split strings using separator symbols in C#


We had some interesting string as follows which need to split and take the desired portion. C#.Net provides special string function called Split, which helps you broke complex strings into fragments.

Here are our Stings look like

121 | Whole Sale Rate

131 | Retail Rate

We begin with initialization of string and then build separator array, then call the split method. I guess you are familiar with the string array if you don’t just look at the 3rd line.

string  st=”121 | Whole Sale Rate”;

Here  “|” is the separator

string[] separator= { “|” };

string []selRateStr = null;

Let’s split the string with Split, which is the function available with string object also with ToString() too.

selRateStr =st.Split(separator,StringSplitOptions.None);

the first element in the selRateStr will be 121, which can be accessed as selRateStr [0];

Here is the authentic link from MSDN which may help you to learn Split function in detail.

 

 

Change location of control at runtime in C#

Change location of control at runtime in C#


Beginners of C# who were familiar with VB6 may try to move the control using left and top properties of the control. It works fine with the Visual Basic 6. In Visual Studio the concept is changed with Location.

A location has two coordinates, namely x and y, similar to Top and Left in VB6. A location is an object of class Point. So we can change the location of a control using a new point object.

In the following, I have a panel, which I want to move at the run time to another part of the window.

stockpanel.Location = new Point(250, 5);

That’s it.

How to use dataView rowfilter for searching rows in C#.Net

How to use data View row  filter for searching rows in C#.Net


You can simply use SQL query statements to retrieve desired data from database server with C# and ADO.Net. But there are plenty of ways to search your localized version of data which is stored in dataSet and dataView.

We already learn how to use Find and Findrow methods for searching data in Visual Studio App. This post will show how to use row filter property of  DataView for sorting data rows.

  1. First up all you need to create Data adaptor, dataSet, and dataView.
  2. In our example, I have a date field in the database table, so that I can filter for specific date ranges as follows
 Common.AccountReportDV.RowFilter = "invoicedate>='" + dateTimePicker1.Value.ToShortDateString() + "' and invoicedate<='" + dateTimePicker2.Value.ToShortDateString() + "'";

Here common is a public static class where kept the Database functions. The above statement will be looking for data between the two dates.

You have to use Common.AccountReportDV and not Common.AccountReportDV.Table.rows  for retrieving the result as follows.

foreach (DataRowView row in Common.AccountReportDV)
 { 

console.WriteLine(row["<column name here>"]);

 }

DataRowView is a special class which helps to access data rows in a DataView object.

C# – Change Default “Enter” Key Behavior In DataGridView to left to right


As we know DataGridView in C# act quite differently with Enter key. When user pressed the Enter key it will take them to next row instead of next column.  For more convenient data entry require left to right movement not top to bottom . C#.Net has ability to change the default behavior of the enter key.

This can be done with overriding the processcmdKey method.

This will change Enter key behavior on the form itself. If you have any code to move focus to other controls it may fail

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

{

// Check if Enter is pressed

if (keyData == Keys.Enter)

{

try

{

if (dataGridView1.CurrentCell.ColumnIndex == 9)

{

dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index + 1].Cells[1];

return true;

}

else

{

SendKeys.Send(“{right }”);

}

}

catch (Exception e)

{

dataGridView1.Rows.Add();

dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells[1];

 

}

return true;

}

return base.ProcessCmdKey(ref msg, keyData);

}

add the above overriding section to the end of the class methods. The Catch method check for the error when there are no rows and add a new row, focus the column.

The original post which help me to solve the problem can be found on inforbiro.com

 

List All the Table Names in VB Net

How to List all data tables from a access .accdb file in VB.net using the ‘GetSchema’ Method. This tutorial is quick access to the problem.


How to List all data tables from a access .accdb file in VB.net using the ‘GetSchema’ Method. This tutorial is quick access to the problem.

VB.Net tutorial: How to add all columns to of table into Listview in VB.Net

How to add all column names into a listview Column header in VB.Net


How to add all column names into a listview Column header in VB.Net, here is my complete tutorial for you