I.T. Discussion Community!
-Collapse +Expand
C#
Search C# Group:

Advanced
-Collapse +Expand C# Group Home

WEEKLYLESSON
Week 42 Lesson◄╣

MY
GROUPSETTINGS
-Collapse +Expand C# To/From
To/FromCODEGuides
-Collapse +Expand C# Study Test
PRESTWOODCERTIFIED
-Collapse +Expand C# Store
PRESTWOODSTORE
   ► All GroupsC# Group   Print This    All Groups  

Weekly C# Lesson

Week 42, Posted Monday 10/21/2019

Content changes every Monday @ 1AM!! Check back once per week. Learn! Review! Test Yourself!

Weekly C# Lesson

[Print Lesson]

Week 42, Posted Monday 10/21/2019

Content changes every Monday @ 1AM!! Check back once per week. Learn! Review! Test Yourself!

FAQ of the Week
Question:

Can I use a Win32 DLL in my Visual Studio.Net application?



Answer:

Yes. The trick is to use the [DllImport] attribute, followed by declarations for each of the DLL's functions and procedures.

Tip of the Week

None This Week
Code Snippet of the Week
[DllImport] attribute

This code allows you to use Win32 DLLs in your .NET applications.

public class Form1 : System.Windows.Forms.Form
{
[DllImport("GetMyCode.dll")]
public static extern string GenerateMyCode(string pProduct,
string pVersion, string pName);

// other form properties, etc...

Note that, below the [DllImport] attribute, you must declare the functions and procedures exported by the DLL you want to use.

Definition of the Week
Attribute:  An attribute is a "shorthand" mechansim for having additional metadata included in your assembly.

Attributes cause additional metadata to be included in your assembly and, utilized when reflected over by another class. For your convenience, many, many useful attributes are pre-defined.

In C#, attributes are designated by enclusure in square brackets. For example, the [DllImport] attribute allows .NET to utilize Win32 DLLs. Another example is the [Serializable] attribute, which causes your class to be persisted to disk.

Link of the Week
The Official Microsoft ASP.Net Site

Microsoft portal site for the ASP.NET development community.

File of the Week
Free E-Book on C# .NET Essentials

Lastest C# Flashcard

Our flashcards are part of our library of tidbits.

Tidbits are FAQs, Definitions, Tips, and Code Snippets from our knowledge base.

Consuming an RSS feed in ASP.NET

Using this quickie code snippet, you can attach an ASP:Gridview  to an external RSS Feed.

All you need to accomplish this is the URL of a usable feed.

Create a ASP AJAX webform, and drop in a GRIDVIEW control, and a button.  Double click the button control and add this code.  You'll need to add these two namespaces to your using section.

using System.Xml;
using System.Data;

This snippet will fill it with DICE ASP.NET open postings.

protected void Button1_Click(object sender, EventArgs e)
{
    XmlTextReader myReader = new
XmlTextReader("http://rss.dice.com//system/net-jobs.xml");
    DataSet myDataSet = new DataSet();
    myDataSet.ReadXml(myReader);
    GridView1.DataSource=myDataSet.Tables[3];
    GridView1.DataBind();
}
Posted By Bryan Valencia, Post #102107, KB Topic: WebForms Coding Tasks

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech