C# is a new language created by Microsoft and submitted to the ECMA for standardization. This new language was created by a team of people at Microsoft led by Anders Hejlsberg . Interestingly, Hejlsberg is a Microsoft Distinguished Engineer who has created other products and languages, including Borland Turbo C++ and Borland Delphi. With C#, they focused on taking what was right about existing languages and adding improvements to make something better.
Also search Google for the following C# Links
DeveloperLand, ASP Folks, C# Games, C# Information Portal, Dot Net Buzz, DOT.NET Solutions, Learn C#, C# Crawler, Visual C#, Visual C# Community Site, Dot Net Book Reviews, Lutz Roeder’s Programming .NET, C# Arena, C# Introduction and Overview, C# Reference, C# Index, Basic C# Info, C# Home, .Net (dotnet) Tips and Tutorials
The same question is asked in other words as follows.
Here is a sample code for reading microsoft excel (MS Excel) file using C# .net.
This is application a prototype that explains using Microsoft Excel 10.0 Object Library to read excel file. With the use of this library, you can load, read and write the excel file contents.
Note: Here, I have created test.xls file which will be copied to c:\ before run the application.
Application developed using sample console application under VC# projects.
Steps:
1. Include the following reference into the project : Microsoft Excel 10.0 Object Library Microsoft Office 10.0 Object Library 2. Include the name space i.e. using Excel. 3. Creating the ExcelApplicationClass,WorkBook and Range.
Find the complete code below:
using System;
using Excel;
namespace TestExcel
{
class ExcelApplication
{
[STAThread]
static void Main(string[] args)
{
string Path = @"c:\test.xls";
// initialize the Excel Application class
Excel.ApplicationClass app = new ApplicationClass();
// create the workbook object by opening the excel file.
Excel.Workbook workBook = app.Workbooks.Open(Path,
0,
true,
5,
"",
"",
true,
Excel.XlPlatform.xlWindows,
"\t",
false,
false,
0,
true,
1,
0);
// Get The Active Worksheet Using Sheet Name Or Active Sheet
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;
int index = 0;
// This row,column index should be changed as per your need.
// that is which cell in the excel you are interesting to read.
object rowIndex = 2;
object colIndex1 = 1;
object colIndex2 = 2;
try
{
while ( ((Excel.Range)workSheet.Cells[rowIndex,colIndex1]).Value2 != null )
{
rowIndex = 2+index;
string firstName = ((Excel.Range)workSheet.Cells[rowIndex,colIndex1]).Value2.ToString();
string lastName = ((Excel.Range)workSheet.Cells[rowIndex,colIndex2]).Value2.ToString();
Console.WriteLine("Name : {0},{1} ",firstName,lastName);
index++;
}
}
catch(Exception ex)
{
app.Quit();
Console.WriteLine(ex.Message);
}
}
}
}
The same question is applicable for all other dot net (.NET) languages. The question could be rephrased as:
When populating a combobox on form load with an arraylist that contains objects of the type ABC Now after combobox is filled with the valid values, I want to have the combobox in C# change the selected item to be a specific ABC object, how do I accomplish it ?You can select the combobox item by its ValueMember
You can use: combo1.SelectedValue = YourValue This will select the item with the value "YourValue" combo1.SelectedValue = YourValue ABC abc1 = (ABC) combo1.SelectedItem Combobox.FindByText(someText).Selected = true; or Combobox.FindByValue(someValue).Selected = true;
Use the first if you want the text displayed in the combobox to find the item you want selected, use the second if you want to use the items value (mostly the ID).
Combobox.FindByText(someText).Selected = true; or Combobox.FindByValue(someValue).Selected = true;
Use the first if you want the text displayed in the combobox to find the item you want selected, use the second if you want to use the items value (mostly the ID).
or
See This: abc1.SelectedIndex = x; where x = numbe of the item in the list. or else abc1.SelectedText = string; where string = value in the combobox that you want to be selected
How do I read an xml file from URL that requires username and password to login to the page.
Use the following Code in C#
//Include the following packages using System.Net; using System.IO;
//request the particular web page
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://sharpprogrammer.com/rss.xml");
//define the login credentials of the requested file/page
request.Credentials = new NetworkCredential(“User Name”, “Password”);
//get the response from the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//create a stream to hold the contents of the response (in this case it is the contents of the XML file
Stream receiveStream = response.GetResponseStream();
//create your XML document
XmlDocument mySourceDoc = new XmlDocument();
//load the file from the stream
mySourceDoc.Load(receiveStream);
//close the stream
receiveStream.Close()
How do I get Visual Studio debugger to show me the data in the arrays? I don’t want to see just one value at a time; I want to see the values contained in array indices [100] to [199] for example.
I don’t know about other versions, but right now I’m using VS2005, and I can see the values in an array while stopped in debug mode by right clicking on the variable and selecting “Quick Watch…”
That will produce a nice little window listing all the values in the array. I’m not sure if that’s exactly what you want, but that’s the closest thing that I’m aware of.
Personally, I have to use VS everyday, and I’m convinced it’s the biggest piece of trash IDE that I’ve ever used.
One way is to specify the index in your debugger. Like arrayname[105] – that should give you the exact value at that index.
If yours were fixed length arrays, getting the value of a range would not be difficult. The debugger would then provide a small + sign beside your array object in the quick watch, and you could expand it to see all the elements.
But with free pointers, the debugger cannot do that. Becasue it does not know the length of the array. And Microsoft has taken a very tight fisted approach towards accessing out of bounds values, even in read only mode by the debugger – so it does not take any risk.
If you are so hell bent on seeing the values of a range, you have to do some little extra work dude:
Option A: Use the managed framework and declare an arraylist object, load it using your native array specifying the length. Your debugger will instantly show all the elements of the array list object expandable/ collapsible with a + sign
Option B: Write them down to a file on the hard disk ([index]:[value] format), open and inspect the file while debugging.
Option C: Declare a test only fixed length array (that you can comment later on), copy the contents of the native pointer array to it, and let the debugger do the rest.
Option D, E, F, …: Give it up. There are better things to do in life.
This is a very dangerous topic. Everyone will likely tell you that the language they work with on a regular basis is the best one to use. Same with Mac vs PC or Oracle vs SQL Server.
To choose a language you should do an analysis of your needs (requirements of your applications) and your skill set (very important). And match them to the languages features. Just having a certain skill set available could be enough of a reason to go with any of the major languages.
Here are some questions to be asked
- Is this a commercial web application to be hosted in a space.
- Ability to spend on software licenses
- Ability to maintain.
- The decision of programming language should consider the clients ability to spend on infrastructure.
ASP.NET/C# is one of the best recommendation people would give. C# is the future language and programmers love it. It accelerates the development cycle, and the recommended language for the Web. There are plenty of examples.
Easiest tool for web app with MS SQL is ASP.Net with C# or VB.Net.But the catch is if the client ready to invest for Server license and mainintenance
The other option is to go for jsp which is open source and doesnt require server licenses but application development would be slow so as maintenance.
Also look at ColdFusion : http://www.adobe.com/products/coldfusion/
If you are comfortable with javascript syntax, it won’t be difficult to pickup C#. If you are comfortable with VBScript, then it won’t be difficult to pickup VB.Net. There is a higher demand for C# developers than VB.NET in the job market.
If you’re an experienced developer or a manager, it helps to consider these, when choosing a platform:
- Longetivity. How long is the technology valid?
- Development cycle time.
- Deployment time.
- Compatibility issues with other OS.
a minimum of these. If you go by that, asp.net/C# is the future.
Head First Java, 2nd Edition by Kathy Sierra, Bert Bates
Book Description
Learning a complex new language is no easy task especially when it s an object-oriented computer programming language like Java. You might think the problem is your brain. It seems to have a mind of its own, a mind that doesn’t always want to take in the dry, technical stuff you’re forced to study.

The fact is your brain craves novelty. It’s constantly searching, scanning, waiting for something unusual to happen. After all, that’s the way
it was built to help you stay alive. It takes all the routine, ordinary, dull stuff and filters it to the background so it won’t interfere with your brain’s real work–recording things that matter. How does your brain know what matters? It’s like the creators of the Head First approach say, suppose you’re out for a hike and a tiger jumps in front of you, what happens in your brain? Neurons fire. Emotions crank up. Chemicals surge.
That’s how your brain knows.
And that’s how your brain will learn Java. Head First Java combines puzzles, strong visuals, mysteries, and soul-searching interviews with famous Java objects to engage you in many different ways. It’s fast, it’s fun, and it’s effective. And, despite its playful appearance, Head First Java is serious stuff: a complete introduction to object-oriented programming and Java. You’ll learn everything from the fundamentals to advanced topics, including threads, network sockets, and distributed programming with RMI. And the new. second edition focuses on Java 5.0, the latest version of the Java language and development platform. Because Java 5.0 is a major update to the platform, with deep, code-level changes, even more careful study and implementation is required. So learning the Head First way is more important than ever.
If you’ve read a Head First book, you know what to expect–a visually rich format designed for the way your brain works. If you haven’t, you’re in for a treat. You’ll see why people say it’s unlike any other Java book you’ve ever read.
By exploiting how your brain works, Head First Java compresses the time it takes to learn and retain–complex information. Its unique approach not only shows you what you need to know about Java syntax, it teaches you to think like a Java programmer. If you want to be bored, buy some other book. But if you want to understand Java, this book’s for you.
An Amazing Achievment
Who do Kathy Sierra and Bert Bates think they are? Don’t they know that learning a programming language is supposed to be hard? Don’t they know that it is supposed to involve suffering? Apparently not, as they have written a complete introduction to Java that is fun to read and easy to understand. If we don’t stamp this out now, students will start expecting their teachers to be entertaining!
The book is an excellent introduction to Java. It covers all the typical topics of a basic introductory text and some extra including serialization, networking, and distributed computing. Each topic is covered in a fun way with important information highlighted. The authors use stories, fake interviews, pictures, and assorted other clever techniques to catch your imagination and make the topics memorable. There are plenty of exercises (with answers) to help you check to be sure you understood each chapter. And there are plenty of fun programs to code including a cool music machine instead of the typical “reverse a String” exercises.
Professional Search engine optimization with PHP: A Developer’s Guide to SEO by Jaimie Sirovich Cristian Darie
Book Description
Maybe you’re a great programmer or IT professional, but marketing isn’t your thing. Or perhaps you’re a tech-savvy search engine marketer who wants a peek under the hood of a search engine optimized web site. Search engine marketing is a field where technology and marketing are both critical and interdependent, because small changes in the implementation of a web site can make you or break you in search engine rankings. Furthermore, the fusion of technology and marketing know-how can create web site features that attract more visitors.
The mission of this book is to help web developers create web sites that rank well with the major search engines, and to teach search engine marketers how to use technology to their advantage. We assert that neither marketing nor IT can exist in a vacuum, and it is essential that they not see themselves as opposing forces in an organization. They must work together. This book aims to educate both sides in that regard.
Professional Search engine optimization with PHP
Search engine optimization (SEO) is not only the job of the marketing department. It must be considered from a web site’s inception and throughout its lifetime by you, the web site developer. Making changes to the architecture of a web site and modifying presentation techniques can dramatically increase search engine rankings and traffic levels.
Written for the PHP developer or tech-savvy marketer, this unique reference provides techniques for creating and maintaining web sites optimized for search engines. You’ll discover how to facilitate the indexing of your site, as well as how to leverage specific technologies and services for site promotion. You will understand the role of web site architecture in search engine optimization and explore various topics therein. Knowing this will help you to develop a site that achieves great search engine rankings. Finally, you’ll apply this knowledge by creating a sample e-commerce catalog and an optimized WordPress blog.
What you will learn from this book
Who this book is for
This book is for PHP developers who need to incorporate search engine optimization principles into their web applications, as well as marketers who want to gain a better understanding of the technologies involved in search engine marketing.
Wrox Professional guides are planned and written by working programmers to meet the real-world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job.
A must read for PHP developers who develop commercial websites
Most websites are developed without SEO in mind. They are often developed by teams that have a very deep knowledge and understanding about programming websites and applications, databases and also general business and e-commerce. A large (if not the most) number of those teams only have little or no knowledge of SEO at all. The result is a website that might violates some of the very basic rules of creating a site that is well accessible and understandable for the human visitors as well as the non-human visitors (the search engine spiders or crawlers).
Changing a site after it is live and around for a while, when somebody realizes that search engine traffic is not the way it should be, can be very costly and in the worst cases may be even require an almost entire rewrite of the website code.
That’s why is it important that not only marketers are being educated about the benefits and principles of search engine optimization, but the people that build websites as well. Who builds websites? Web developers. This book was written exactly for this audience, but also a SEO who knows most of the information to SEO provided in the book could benefit from this book. It includes a lot of very practical PHP sample source code for ready to use tools that can help marketers in their daily routine.
Although a lot of the content is not PHP specific are other parts that are using a lot of sample source code to demonstrate possible solutions, specific for Apache web servers (.htaccess), PHP and MySQL Databases.
Great Book for Non-Programmers Too!
Running a successful search engine optimization firm means that I have to have a solid understanding in numerous coding strategies that can play a role in an SEO campaign.
This is a book written by programmers for programmers. Rarely will you go more than a couple of pages without getting an in-depth look at php code illustrating just how certain jobs are done. But that should not dissuade the non-programmer. Going through this book I did a good deal of skipping. I don’t need to know the code–wouldn’t understand it anyway–but what I did get was a solid grasp on how PHP can be an extremely effective tool in a search engine optimization campaign.
So what can you learn in a book about PHP without knowing PHP? You’ll get a crash course in creating search engine friendly URLs, redirects, duplicate content, search friendly html, web feeds, sitemaps, link bait, cloaking and a whole lot in between. For the non-programmer I found all the things that you can do with PHP fascinating. The concepts here are nothing new but I’m certain my programmers will find information in here that they can apply liberally throughout our client campaigns.
Solid PHP How-To
Last year, I reviewed the book
Jaimie Sirovich is a self-titled “SEO Egghead” and is a hybrid programmer turned search engine marketer. What makes him uniquely qualified is that he understands the tech side of SEO and isn’t just a slimey snake oil salesman who spouts off conjecture. He holds a bachelor’s degree in Computer Science.
Cristian Darie is a software engineer and PhD student, currently studying distributed application architecture for his dissertation. He has published several books on a variety of web topics – including: