Jump to content

Search the Community

Showing results for tags 'C#'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 19 results

  1. I am to do a simple calculator in C# windows forum. This is my first time doing C# and I've scoured what I could to figure this out. I'm not looking to copy and paste, I want to understand what I'm doing. My biggest issue at this moment is figuring out how to have the calculator solve a line of numbers. My calculator you can hit the buttons to enter numbers and the expression or whatever, but I can only figure out how to do it with two numbers. Any Ideas?
  2. How i can filter List the data with Dictionary condition using linq. class Person { public string name { get; set; } public string subject { get; set; } public string type { get; set; } public int age { get; set; } } class Test { public void FindData() { // Create dictionary and add five keys and values. var conditionDictionary = new Dictionary<string, string>(); conditionDictionary.Add("subject", "english"); conditionDictionary.Add("type", "teacher"); List<Person> persons = new List<Person>(); persons.Add(new Person { name = "Rajul", subject = "math", type = "teacher", age = 20 }); persons.Add(new Person { name = "Jhon", subject = "english", type = "teacher", age = 25 }); persons.Add(new Person { name = "Nitin", subject = "english", type = "student", age = 21 }); persons.Add(new Person { name = "Sumit", subject = "english", type = "teacher", age = 26 }); persons.Add(new Person { name = "Komal", subject = "science", type = "student", age = 29 }); List<Person> filteredpersons = Filter(persons, conditionDictionary); } public List<Person> Filter(List<Person> persons, Dictionary<string, string> conditionDictionary) { /*TODO: can you suggest how to filter list data using linq with Distionary*/ var list = (from person in persons from condition in conditionDictionary select person).ToList(); return list; } }
  3. I am making a music store project.. I want some method so that users can upload mp3 files in it.. i have tried many codes but i cud not do it. please tell me how i can complete this..
  4. How can we parse a word document using asp.net and c#. The question I have is with respect to parsing a word document, say a resume, to read the contents like name and email address. For this, I have an idea, but not sure of how to implement it. Can someone help me on this?My idea is: -Take the first line, if there are two or more words (other than curriculum vitae)separated by a single space or using a period(.) followed by a space, it is a name. -Take the second line, if there are two or more words separated by a single space or using a period(.) followed by a space, it is a name. -Consider the last line, if there are two or more words separated by a single space or using a period(.) followed by a space, it is a name. -Consider the second last line, if there are two or more words separated by a single space or using a period(.) followed by a space, it is a name. I know how to read tellno and email using patters, but, I dont know how to implement finding out the name. Is there any idea ?
  5. Is it possible to extend the OAuthGrantResourceOwnerCredentialsContext class from Microsoft.Owin.Security.OAuth? when implementing my custom OAuthProvider I want to be able to add a new IList to the context in order to send messages that will be intercepted by Growl in AngularJs. what i want to do in case of an error for example is something like: public class CustomOAuthProvider : OAuthAuthorizationServerProviderExtended{ //removed code for brevity public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContextExtended context) { //removed code for brevity ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password); if (user == null) { context.messages.Add(GeneralEx.CreateGrowlMessage("The company, user name or password is incorrect.", "error")); return; } //removed code for brevity }} where CreateGrowlMessage is public static GrowlMessage CreateGrowlMessage(string message, string severity) { GrowlMessage growlMessage = new GrowlMessage(); growlMessage.text = message; growlMessage.severity = severity; return growlMessage; } and GrowlMessage is public class GrowlMessage{ public string text; public string severity;} I was trying to extend both OAuthAuthorizationServerProvider and OAuthGrantResourceOwnerCredentialsContext shown bellow public class OAuthAuthorizationServerProviderExtended : OAuthAuthorizationServerProvider { public virtual Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContextExtended context) { return Task.FromResult<object>(null); } } public class OAuthGrantResourceOwnerCredentialsContextExtended : OAuthGrantResourceOwnerCredentialsContext { public OAuthGrantResourceOwnerCredentialsContextExtended(IOwinContext context, OAuthAuthorizationServerOptions options, string clientId, string userName, string password, IList<string> scope) : base(context, options, clientId, userName, password, scope) { } public IList<GrowlMessage> messages {get;set;} } but this is not having the desired effect. now all login attempts fail and all i get in the response is {"error":"invalid_grant"}
  6. how to read xml nodes with same name in c#? I have XML file with a users, and their personal informations(name, surname, age, photos...). I'm displaying this infos in gridview, and everything is ok. Just cannot select one photo to display in the gridview, one photo for every user, like profile photo. I cannot do this cause there is not a tag . There are more tags with same name like in example below. So i'm trying to select all infos, put in datatable, and display in gridview control with Eval("Foto") functioon. But photos cannot be displayd because in evel function cannot be inserted more photos in same time. This is the structure of the photos in the XML document: <User><Name>User name</Name><Surname>User surname</Surname><Foto>http://website.com/images/image1.jpg</Foto><Foto>http://website.com/images/image2.jpg</Foto><Foto>http://website.com/images/image3.jpg</Foto><Foto>http://website.com/images/image4.jpg</Foto></User> This is the gridview control which i use <asp:GridView ID="GridView1" ShowFooter="false" ShowHeader="false" CssClass="tablepress-id-N" runat="server" AutoGenerateColumns="false" AllowPaging="true" OnPageIndexChanging="OnPageIndexChanging" onrowdatabound="GridView1_RowDataBound"><Columns><asp:TemplateField><ItemTemplate><li class="objectListItem"><div style="float:left;width:12%;margin-right:5%;"><asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Foto")%>'></asp:Image></div></ItemTemplate></asp:TemplateField></Columns><pagerstyle cssclass="gridviewPager"></pagerstyle></asp:GridView> Where i make a mistake?
  7. been searching for the answer for a long time i have this working code for a simple photo gallery for viewing photos when the images are too many it will take a long time to load all the imagebuttons i want to limit the imagebutton's to load only 10 photos, i will just put another next button for the next 10 photos and so on. this foreach loop portion is where it loads all the pictures inside the folder named "loveones" ImageButton imageButton = new ImageButton();FileInfo fileInfo = new FileInfo(strFileName);imageButton.ImageUrl = "~/pictures/loveones/" + fileInfo.Name;imageButton.Width = Unit.Pixel(200);imageButton.Height = Unit.Pixel(200);imageButton.Style.Add("padding", "5px");imageButton.Click += new ImageClickEventHandler(imageButton2_Click);Panel1.Controls.Add(imageButton); i wish some one could help me here in w3 school. thanks.
  8. Hello everyone! So I have a webservice that I made in C# that use DataTable, this works fine in my .net application which can consume DataTable. But I can't use it in my java application. So I need a way to convert the DataTable to a List when the java application use the webservice. Could anyone help me out?
  9. Hello Everyone, 'm developing software Customer Management System in C# windows application based on XML Database. In my database near by 1,00,000 entries. i have a trouble in retrieving 1,00,000 entries. its take more time to show the data. let me know the fast retrieving solutions as soon as possible. Its My Coding (Retrieving) XElement xelement1 = XElement.Load(ZXmlDetails.Path + @"Noti_Payment.hash"); var detailss1 = (from nm in xelement1.Elements("Details") orderby (String)nm.Element("IBillNo") select nm); if (detailss1.Count() > 0) { foreach (var xEle1 in detailss1.Distinct()) { int x = PaymentLoop.Rows.Add(); PaymentLoop.Rows[x].Cells[0].Value = xEle1.Element("IBillNo").Value.ToString(); PaymentLoop.Rows[x].Cells[1].Value = xEle1.Element("CName").Value.ToString() + " -- " + xEle1.Element("CPhoneNo").Value.ToString(); PaymentLoop.Rows[x].Cells[2].Value = xEle1.Element("NetTotal").Value.ToString(); PaymentLoop.Rows[x].Cells[3].Value = Convert.ToDouble(xEle1.Element("NetTotal").Value.ToString()) - Convert.ToDouble(xEle1.Element("Payment").Value.ToString()); } } Thanks & Regards
  10. i have a form in which i have a field date of birth , and a textbox to fill date of birth , when a person fills his date of birth like 01/01/1990 , then it will be saved into database , and when i retrieve this date form database then this comes 01/01/1990 12:00 AM , i want only date part from it. This is my form to fillup date of birth form.aspx <tr> <td width="30%"> Date of Birth <br /> </td> <td style="width: 1px"> :<asp:TextBox ID="txtDateofBirth" runat="server" placeholder="dd/mm/yyyy"></asp:TextBox> </td> <td class="td2"> </td> </tr> this is code for form.aspx.cs SqlCommand cmd = new SqlCommand("insert into ApplicantForm(NameofApplicant, dateofbirth)" + "values( @NameofApplicant, convert(Datetime, @dateofBirth, 103)", con); cmd.Parameters.AddWithValue("@dateofBirth",txtDateofBirth.Text); this is code for print of this date of birth print.aspx <asp:Label ID="txtDOB" runat="server" ></asp:Label> this is code print.aspx.cs SqlCommand cmd = new SqlCommand("Select * from ApplicantForm Where ApplicantId=" + ((Request.QueryString["ApplicantId"])) + "", con); dr = cmd.ExecuteReader(); txtDOB.Text = dr["dob"].ToString();
  11. Hi, I have a Master page which needs to inherit from a class (MasterPage2.cs) stored inside "App_Web_yht1mma2" folder. In the master page, I have set the code as: <%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %> When I debug this page, I receive the following error: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load the assembly 'App_Web_yht1mma2'. Make sure that it is compiled before accessing the page.Source Error: Line 1: <%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>Line 2: Line 3: Source File: /MasterPage.master Line: 1 Kindly advise.
  12. I am trying to learn any programming language and I have looked into several sites including Oracle and I must say everything I've tried to learn hasn't stayed in well. I personally love the layout and the design as well as the ability to try it yourself on W3Schools' site. I Understand that W3Schools was made to teach everything you need to know to create a webpage, or to be used as a reference to commands in a language used in making a webpage, but I and many others would greatly benefit if W3Schools could adopt a programming section. I am starting to learn Java and as for right now I only request Java, But I would like to see all commonly used programming language. I used W3Schools to learn HTML, CSS, and a little bit of JavaScript, It took me a little under 7 hours to learn a large portion of HMTL and CSS. I just love W3Schools' Website and Teaching ways. I would love to learn every language possible here, I find this the best way to learn Computer languages.
  13. I'm having trouble sending emails from an email like "mail@domain.com" wich is configured to use the live.mail.com client. Even though i think i'm using the right credentials i get the following error: "Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated" this are my configurations: smtpClient = new SmtpClient("smtp.live.com");smtpClient.Port = 587;smtpClient.UseDefaultCredentials = false;smtpClient.Credentials = new System.Net.NetworkCredential("mail@domain.com", "Password");smtpClient.EnableSsl = true; any help is appreciated, for I can't seem to work-arround this problem and have to have this website online ASAP
  14. hello... I have written a stored procedure to get a column Named as "Name" from the table DN_Software.The query is "Select Name From DN_Software Where DN_DiscoverHostID=5" for Particular ID. Now i want to display that list of names in front end page. please help me how to display using that stored procedure using asp.net displaying in c#.please... "ALTER PROCEDURE [dbo].[DN_Software_Read_Distinct_Name_By_DiscoveredHostID]( @Active [int], @DN_DiscoveredHostID Int) AS SELECT DISTINCT Name FROM DN_Software where DN_DiscoveredHostID = @DN_DiscoveredHostID --EXEC DN_Software_Read_Distinct_Name_By_DiscoveredHostID @Active = 1, @DN_DiscoveredHostID = 5" --------------this my stored procedure.
  15. hai...please give one simple example to open a text file using c#.
  16. Please provide the tutorial on ASP.NET with C# based on Visual studio, not on WebMatrix
  17. I'm trying to transform a SVG-file into another XML-file using XSLT and the C# class XslCompiledTransform. This is my SVG <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" version="1.1" baseProfile="full" width="800mm" height="600mm"><rect x="10" y="10" width="90" height="40" /></svg> This is my C#-Code static void Main(string[] args) { string xmlSource = args[0]; string xmlOutput = args[1]; string xsltFile = args[2]; // if xslt or soure contains a DTD: XmlReaderSettings xmlReadSet = new XmlReaderSettings(); xmlReadSet.DtdProcessing = DtdProcessing.Parse; xmlReadSet.ValidationType = ValidationType.Schema; XslCompiledTransform xslt = new XslCompiledTransform(); // XmlWriterSettings xmlWriteSet = new XmlWriterSettings(); xmlWriteSet.ConformanceLevel = ConformanceLevel.Auto; // xslt.Load(xsltFile); xslt.Transform(XmlReader.Create(xmlSource, xmlReadSet), XmlWriter.Create(xmlOutput, xmlWriteSet)); } And this is my XSLT <?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="xml" version="1.0" indent="yes" encoding="utf-8" omit-xml-declaration="no"/> <xsl:template match="/"> <xsl:element name="Redlining"> <xsl:attribute name="hash">???</xsl:attribute> <xsl:attribute name="version">4.1</xsl:attribute> <xsl:element name="BoundingBox"> <xsl:attribute name="xMin">???</xsl:attribute> <xsl:attribute name="yMin">???</xsl:attribute> <xsl:attribute name="xMax">???</xsl:attribute> <xsl:attribute name="yMax">???</xsl:attribute> </xsl:element> <xsl:element name="GeometryHolder" /> <xsl:apply-templates select="rect"/> </xsl:element> </xsl:template> <xsl:template match="rect"> <xsl:element name="RectangleHolder"> <xsl:element name="Sector"> <xsl:attribute name="type">sector</xsl:attribute> <xsl:element name="Coordinate"> <xsl:attribute name="x"> <xsl:value-of select="@x + @width"/> </xsl:attribute> </xsl:element> </xsl:element> </xsl:element> </xsl:template></xsl:stylesheet> And this is what I get <Redlining hash="???" version="4.1"><BoundingBox xMin="???" yMin="???" xMax="???" yMax="???" /><GeometryHolder /></Redlining> As you can see the template "rect" is omitted. I got the advice to use this ... <xsl:apply-templates select=".//*[local-name()='rect']"/> ... ... <xsl:template match="*[local-name()='rect']"> ... Then I get what I want. But I don't understand what is wrong with my attempt since it seems that all the tutorials do it like my attempt. Or am I missing something? Thanks for reading, Stefan
  18. Without gridview how can i show report in asp.net
  19. Hello,I am working on my final project for school and I have to post certain form tasks to the database. I am not all that sharp on every aspect of data connections yet and am struggling. I am using the connection that visual studio creates when you drag and drop the table on the form. It is all working great when I do things by my book, but my teacher asked us to insert something into the data base and I cannot figure out that part. I was looking at an article online about saving something to the database, but it was creating a new object of the class for a specific table and they did not have a visual of the class. I started fumbling my way through that and it was not going too well. I need some more specific help because I am not educated enough yet to figure this out in the time frame I have. Here is part of my code. I want to insert the info in the fields into the database once it passes the test. The test works fine. private void regSubmitButton_Click(object sender, EventArgs e){byte use = Convert.ToByte(userIDBox.Text); string pass = passBox.Text; this.lib_UserTableAdapter.Fill(this.libraryProjDataSet.Lib_User); var match = from u in this.libraryProjDataSet.Lib_User where (u.User_ID == use) select u.User_ID; var match3 = from u in this.libraryProjDataSet.Lib_User where (u.Password == pass) select u.Password; try{ if (match.Count() != 0 || match3.Count() != 0){userIDBox.Text = " ";passBox.Text = " ";errorUlabel.Visible = true;}else{mainPage MainPage = new mainPage();MainPage.Show(); }
  • Create New...