Skip to main content

Posts

Showing posts from February, 2015

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Insert data into database table using edmx file in windows form c#

Introduction In my previous article i have already explained about login control , in which i was add edmx file . Now, today we will learn about register control or you can say how to insert data into database. Steps First to prepare database table with some fields. Create a new project in the windows form. Add edmx file in the solution. If you want to add data using input control in the database table then take some text boxes and other control in the form. Otherwise you can do this without input field--see the example, which is explained below. Now, the model class in the entity framework is: (check your solution explorer after add edmx file in the project) namespace WindowsFormsApplication4 {     using System;     using System.Collections.Generic;          public partial class Student_record     {         public int Id { get; set; }         public string Student_Id { get; set; }         public string Student_Name { get; set; }         publi

Custom login control using edmx file in windows forms application C#

Introduction Login contol provide some privilege to the project or you can say its a entry point of the project. Though this form we can move to the next form. If your input text is valid then move to the next but if your input is wrong then move failed. So, the main function of the project is check each entry of the table with the TextBox. Design login control in windows form Add Two TextBox with the label control. Add one button control with click event , Look like Add EDMX file with the help of following steps: Add ADO.NET Entity Data Model by the add new item component. Now, select EF designer from database in the entity data model wizard. Now create the connection by pressing the 'new connection' button , also select the check box where your connection string save into your application configuration file. Now, press to next button. Select entity framework version , i select 5.0 in the project. Select table, views , stored procedure in the appea

C language: Searching in graph

Similar to traversal of graph two searching techniques of the graph are used which are Breadth First Search and Depth First Search. Both the techniques are same as respective traversal techniques. In case of breadth first search the traversal algorithm for breadth first is used. The algorithm is terminated with a message search successful whenever the deleted item from QUEUE is the node to be searched otherwise the algorithm is terminated with a message search unsuccessful when the QUEUE is empty. The formal algorithm for BFS is: GRAPHBFS [goal node is the node to be searched] Mark the start node and insert it in the QUEUE If the start node is the goal node Then: Write: 'Search Successful' ; Exit [End of If] Repeat While QUEUE is not empty Delete QUEUE If deleted node is the goal node Then: Write: ' Search successful;; Exit. Else Mark the unmarked adjacent nodes of the deleted node. Insert the marked nodes(if any) of the deleted node in the QUE

C Language: Depth First Traversal in Graph

This traversal techniques is based on the fact of visiting all the nodes of graph in the depth of it. It means start from the start node of the graph and reach to last node of the graph in its depth (so that no further unexplored adjacent node exist). From the start node explore all the adjacent nodes but visit one of the adjacent nodes. From the visited adjacent node further explore all the adjacent nodes of it and again select one of the adjacent nodes and further explore it. In this way the exploration of the adjacent node carried till to reach the last node. Once the last node is reached then back track from the last node to previous node to visit the next adjacent node of it. The data structure stack is used in this type of traversal.  Consider the following graph: The adjacent nodes of node The depth first traversal of the above graph, assuming node 'A' as start node is: A     E      D      C     B You can observe from the traversal result that the f

Successors of C language

C and even B have several direct descendants, through they do not rival pascal. One side branch developed early. When Steven Johnson visited the University of Waterloo on sabbatical in 1972, he brought B with him. It became popular on the Honeywell machines there, and later spawned Eh and Zed (the Canadian answers to 'what follows B?'). When Johnson returned to Bell Labs in 1973, he was disconcerted to find the language whose seeds he brought to Canada had evolved back home; even his own yacc program had been rewritten in C, by Alan Snyder. More recent descendants of C proper include Concurrent C, Objective C, C* and especially C++. The language is also widely used as an intermediate representation (essentially, as a portable assembly language) for a wide variety of compilers, both for direct descendants like C++, and independent languages like Modula 3 and Eiffel. 

C Language standards

C came into existence in between 1969-1973 in parallel with the development of UNIX operating system. The C Programming Language, in the middle of 1980s,was officially standardized by the ANSI X3J11 committee. Until the early 1980s, the language was almost exclusively associated with UNIX. Now, its use has spread much more widely, and today it is among the languages most commonly used in the industry. BCPL the origination for C language was designed by Martin Richard in the mid-1960s and used during the early 1970s for several projects including OS6 operating system at OXford. The original BCPL compiler was transported both to Multics and to the GE-635 GECOS system by Rudd Canaday and others at Bell Labs. It was the language of choice among the group of people who involved with UNIX. BCPL, B, and C all fit firmly in the traditional procedural family characterized by Fortan and Algo60. They are particularly oriented towards system programming. They are close to the machine. BC

Features of C Language

Definition: The capabilities and functionality provided by the C language are collectively called features of C Language. The features of C Language have made it popular. Let us see, "What are the features of C language ?" The C Language being a middle level language has many important features. It is said to be middle level language because of the following features: The C language has the capabilities of assembly Language (Low Level Language) It provide the functionality of a High Level Language. As it is near to machine as well as to the user it is called middle level language. The capabilities of the low level language of C help in designing the program especially required system management. It means the system software can be developed very easily using the C Language. As It is also near to the user, most general purpose programs can be developed easily. So, the application programs can also be developed using C language. In addition to the above mentio

How to use ComboBox in windows forms application c#

ComboBox in windows forms application -Introduction A ComboBox display a editable TextBox with ListBox. You can select item from the list also you can search item by using TextBox. The default style of ComboBox is drop-down list. You can change the style of ComboBox with the help of DropDownStyle property. That property contain three enumerated value, If you select Dropdown list box then you can not edit text portion. Now, take a simple example to add items in the Combo Box-please see the video Video contains different ways to add item in the ComboBox like, using show smart tag, items property, add item at run time using add method. For adding items at run time in ComboBox:  comboBox1.Items.Add(String text); If you want to change the DropdownStyle at design as well as run time- please see the following video: I you want to access or retrieve selected item from the comboBox then see this video. In this video i have a comboBox with some fruit items and a button control. Wh

Pointer values in C language

Suppose, we have the following declaration: int i=100, j=200, k=300; This declaration tells the compiler to perform the following activities: Reserve space for three integer values in memory. Associate the variables i,j and k with these memory location. Store 100,200 and 300 at the locations i,j and k respectively as shown as below: Variable Address Memory Locations 0 2 4 100 I …….. 200 J 65534 300 K variables address Values The address of the variable cannot be accessed directly. The address of the variable can be obtained using address operator (& in C) . Note : The address operator can be used with any variable that can be placed on the left side of an assignment operator.Since constants, expressions and array names can not be used on the left hand side of the assignment, and hence accessing ad

Array in C language

Introduction In this chapter, we will discuss a very important data type arrays. Let us see, “Why arrays?’’ We know that in one variable we can store the information of only one  data item. Suppose that a Student has scored 90 marks. These marks can be stored in a variable as shown below: int marks=90; After executing this statement, the value 90 will be stored in the variable marks. Suppose there is A need to store marks of 10 students. In such case, we are forced to use 10 variables like marksl, Marks2… marks10. But, if it is required to store the marks of 100 students, definitely it is not Feasible to use 100 variables marksl ,marks2…marks100, Now, the question is “How to store 100 different marks?” In mathematics, we use sets to group the items of similar kind, For example, consider the set shown below : marks = {80,90,45,99,100,36,88,96,67,92} This is a set of marks of `10 students. Note that every item can be accessed by prefixing marks a

Pointer Declaration and Definition in c language

In C language, we know that all the variables should be declared before they are used. Pointer variable should also be declared before their use. The syntax to declare a pointer variable is shown below. type *  identifier; Type :  type can be any datatype such as int, float , char etc. It may be derived or user defined data type also. *       : The asterisk (*) in between type and identifier tells that the identifier is a pointer variable. Identifier :  Name given to the pointer variable.   Example -1 : Consider the following declaration: int * p; The above declaration can be read as "p is pointer to integer variable" and this declaration informs the following points: The variable p is a pointer variable. So, it should contain the address of variable during execution. The type int refer to the type of the variable stored in pointer variable p i.e. the pointer variable p should contain address of an integer variable. Example-2 : Consider the following d

Initializing a pointer variable in C Language

Initializing a pointer variable Initialization of a pointer variable is the process of assigning the address of a variable or memory to a pointer variable. The initialization of a pointer variable can be done using following three steps : Step-1 : Declare a data variable. Step-2 : Declare a pointer variable. Step-3: Assign address of a data variable to pointer variable using & operator and assignment operator. Note that the Step1 and 2 can be interchanged i.e. we can first declare a pointer variable, then declare a data variable and then initialize the pointer variable. Example : Consider the following three statements: int x; /* Step-1 : x is declared as a data variable */ int *px ; /* Step-2: px is declared as a pointer variable */ px= &x; /* Step-3 : copy address of data variable to pointer variable */ .... ..... Here , the variable x is declared as integer data variable. Since px is pointer variable of type integer, it should contain address of integer va

NULL Pointer in C language

Introduction Definition : A NULL pointer is defined as the special pointer value that points to nowhere in the memory. If it is too early in the code to assign a value to the pointer, then it is better to assign NULL (i.e., \0 or 0) to the pointer. For example , consider the following code: #include<stdio.h> int *p=NULL; Here, the pointer variable p is a NULL pointer, this indicates that the pointer variable p does not point to any part of the memory. The value for NULL is defined in the header file "stdio.h". Instead of using NULL, we can also use '\0' or 0. The programmer can access the data using the pointer variable p if and only if it does not contain NULL. The error condition can be checked using the following statement: if(p==NULL) printf("p does not point to any memory\n"); else { printf("Access the value of p\n"); ...................... } Note : A pointer variable must be initialized. If it is too early to initial

Pointer to Pointer in C language

Introduction Definition : It is possible to make a pointer to point to another pointer variable. A variable which contains address of a pointer variable is called pointer to a pointer. For example, consider the following declarations: int a; int *p1; int *p2; The first declaration instructs the compiler to allocate the memory for the variable a in which integer data can be stored. The second declaration tells the compiler to allocate a memory for the variable p1 in which address of an integer variable can be stored. The third declaration tells the compiler to allocate a memory for the variable p2 in which address of a pointer variable which points to an integer can be stored. The memory organization for the above three declaration is shown below: Example : Memory organization after executing following assignment statement: a=10; p1=&a; p2=&p1; The memory organization after executing the statement a=10 is shown below: The memory organi

Floating point constant in C language

Floating point constant Definition: The numeric values having fractional part are called floating point constants. All  negative Numbers should have prefix ‘- ’. A positive number may have a ‘+’ sign that is optional. Other Character  are not allowed . The floating point constant can be represented using two forms as: 1. Fractional form 2. Exponent notation(Scientific notation) Fractional from: Now, let us see  ‘‘how to represent floating point numbers using fractional form?  Explain giving examples.’’ A floating point number represented using fractional form has an integer part followed by a decimal point and a fractional part. We can omit the digits before the decimal point or after the decimal point. For example, 0.5, -0.99, -6, -9,+.9 etc all are valid floating point numbers. Exponent notation (Scientific notation): Now , the question is ‘‘How to represent floating point numbers in scientific notation? Give examples.’’ The floating point number represented using Scien