C#

93K

Solutions

25K

Contributors

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi All,
Advance thanks for the great solution!
Am using Visual studio 2017 ,c#, MVC. I need to use electronic signature in the .csthml page. I was given strict protocol to follow like not to adapt any third party. i need to capture the signature and display at end of the .cstml page.Please help me or guide me how to do that please...

Kind regards,
Pooja
0
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Hi,

I am using Windows C# application which contains many tab.

i want to hide soe of the Tab based on user roles and privileges.

i used below code. but, it is not working..

string title = "Employee DETAILS";
TabPage myTabPage = new TabPage(title);
Tab3.TabPages.Remove(myTabPage);  


When i ran the application, still the "Employee Details" tab are visible...?

what is the problem in the above code.
0
With C#, how can I check to see if a particular Active Directory group has permissions on a file? So I want to check if DataStewards has read or write access on specific file. If so, enable a button. If not, disable the button. Thanks for any help.
0
Heads-up: Though its little tricky to explain my scenario i will still try my best to explain as clearly as possible.

I have 4 RadGrids(with Column Picker for each RadGrid) on same page & switching between Radgrids doesnt load the current RadGrid name when looking in view source. Though the Data is loaded for different RadGrids.
Issue is with Column Picker.

Requirement: On Change of a RadComboBox List value a different RadGrid has to loaded. Each RadGrid has a COlumn Picker too.
Column Picker -> (list of columns in RadGrid is bided on serverside to a RadListBox and shown in a RadWindow invoked using Javascript )

Basically i have 4 RadGrids(RadGrid1 through RadGrid4) each of which has CommandIteamTemplate -> & asp:LinkButton OnClientClick opens a RadWindow with list of RadGRid Columns whose Display value is True.
Also these 4 RadGrids are 4 seperate user controls with their own unique Javascript methods and Radwindows.

But When ever i chaneg my RAdCombobox value though a different RadGrid is loaded ... Column Picker still shows from the previous RadGrid. At this moment when i look at the view source it still shows previous RadGrid name with java script methods from the same previous RadGrid.

Example: On my Main Page,
Step 1: on page load, RadGrid1 from first user control is loaded with Column picker1 - which was loaded using Javascript1.
sample code in CommandTemplateItem.. <asp:LinkButton ID="lbtnCP" runat="server" …
0
When I compile someone c# code, I got the following warning.  What do I need to resolve this? Any idea?

The primary reference "xxxConfiguration" could not be resolved because it has an indirect dependency on the assembly "xxxAsync, Version=7.05.101.0, Culture=neutral, PublicKeyToken=58aa7495915e0000" which was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
0
Hi, I.'m trying to set up the zoom of an image ,inside a canvas,  to the value of the ribbon menu item selected.
How can I achieve this?

                 ...
                    <RibbonMenuButton Label="Zoom">
                        <RibbonMenuItem Header="25%"/>
                        <RibbonMenuItem Header="50%"/>
                        <RibbonMenuItem Header="75%"/>
                        <RibbonMenuItem Header="100%"/>
                    </RibbonMenuButton>

...

               <ScrollViewer x:Name="scr_Img" Grid.Column="2">
                    <Canvas x:Name="cnv"  Grid.Column="2" Background="Gray">
                        <Grid Width="{Binding ActualWidth, ElementName=cnv_marking}" Height="{Binding ActualHeight, ElementName=cnv}">
                            <Image x:Name="img_Zoom" 
                                SizeChanged="img_Zoom_SizeChanged"
                                MouseDown="img_Zoom_MouseDown" MouseLeftButtonDown="img_Zoom_MouseLeftButtonDown"
                                Height="{Binding ActualHeight, ElementName=cnv}"/>
                        </Grid>
                    </Canvas>
                  </ScrollViewer>

Open in new window

0
The codes below is extracted from mvc razor view page / c#.
My question is how to pass pair name/value back  to mvc controller.

Thanks,


<script>
        function Validator() {
            return true;
        }
        function UpdateEventCost() {
            if (Validator() == true) {
                var totalCount = document.getElementById("totalcount").value;
                alert("Success");
                var inputs = document.getElementsByTagName("input");
                for(x=0; x<=inputs.length;x++)
                {
                    var id_name = inputs[x].getAttribute("id");
                    var id_value = document.getElementById(id_name).value;
                }
                //window.location.href = "/Home/MotorhomeEdit/15";
            }
            else {
                alert("Error");
            }
        }
</script>

Open in new window

0
Hi,

i am using Windows application.

my client want to set password in MS Access DB.

When end user selecting the file from browse button, system should check the password and set password somewhere in the application.

if the set password and Access password is match then system allow further process.

How to do this in Windows C# applications.?
0
How to read Child tags under parent tag with name space in C#?
<ns:tag1></ns tag1>
<ns:tag2>
<child1></child1>
<child2></child2>
</ns:tag2>

How to read child 1 tag?
I am able to till ns:tag2 but unable to read any further tag.
var child = parentElement.Descendants(ns + "tags").First();
This provides list of child tags, but unable to further read it.
Tried a few things like:
child.Descendants("child1").First().Value
and child.Element("child1") (with all possible sub functions)
etc
Even tried to reload the xml from tag2 in XElement again but that threw invalid xml exception.
but all are throwing null pointer exceptions.
0
Hi guys,

I am curious about the benefits of using SDKs. Personally, I prefer avoiding third-party libraries, especially if I don’t see any benefits of having serialized JSON output in class models (I have found this to be the case when using JavaScript, NodeJS, PHP, Python, and other functional programming languages). When using serialized JSON models in Java, C++, C#, and ActionScript, I observed a decline in performance.

However, I am aware that companies including Google, Amazon, Salesforce, etc are generating REST API services for SDK code for developers to consume.
 
What have you found to be the main pros/cons of using SDK, and what are your personal preferences regarding which REST SDK is best for various languages?

Best,
David
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

I have a desktop App dealing with images.  A couple of years ago we built a C# executable that makes JSON calls in order to transact with FaceBook so that users of my desktop App could upload images directly to their Facebook timeline.  All good.  But now, Facebook is changing their scheme, and they are deprecating one "permission" that we needed in order to do this.  Now Facebook says the new scheme should use a "shared dialog" but they seem only to offer support for Android, iOS, and web-servers.  My question is: how can a windows desktop App do the new scheme? Is it possible?
0
i have a psd file which contains two designed screens for my app. My question is, how do I implement it into my application? Thank you all

A basic example would be appreciated
0
Hi,

i'm newbie in C# and web service but i need to read the soap service (xml format) and save it to a SQL tables (dataset)...

here's my client's data:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pix="">
      <soapenv:Header/>
      <soapenv:Body>
            <tem:Request>
                  <pix:wsVersion>v1.2.1</pix:wsVersion>
                  <pix:cname>Testaccount</pix:cname>
                  <pix:sclass>sales</pix:sclass>
                  <pix:PO>PO12345</pix:PO>
                  <pix:method>AIR</pix:method>
                  <pix:product>
                        <pix:style>Abc1</pix:style>
                        <pix:qty>1</pix:qty>
                        <pix:price>1.00</pix:price>
                  </pix:product>
                  <pix:product>
                        <pix:style>Cde1</pix:style>
                        <pix:qty>2</pix:qty>
                        <pix:price>1.00</pix:price>
                  </pix:product>
            </tem:Request>
      </soapenv:Body>
</soapenv:Envelope>

I have 2 classes:
class order
            [MessageBodyMember(Order = 0)]
            public string wsVersion { get; set; }
            [MessageBodyMember(Order = 1)]
            public string cname { get; set; }
            [MessageBodyMember(Order = 2)]
            public string PO { get; set; }
            [MessageBodyMember(Order = 3)]
            public string method { get; set; }
            [MessageBodyMember(Order = 4)]
            [XmlArrayItem("oItems", IsNullable = false)]
            public Item[] Items { get; set; }
class Item
            [XmlElement(Order = 0)]
            public string style { get; set; }
            [XmlElement(Order = 1)]
            public int qty { get; set; }
            [XmlElement(Order = 2)]
            public double price { get; set; }

in service.svc.cs

0
I have the google c# api code and it works fine.But I want to get
child node : photos {height and width}.
rating
open now
weekday text
viewport

Can you help me what I need to do with the codes below? Thank

reference: https://developers.google.com/places/web-service/search


       
protected void Page_Load(object sender, EventArgs e)
        {
             WebClient wc = new WebClient();
            string jsonStr = wc.DownloadString("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.753,-122.443&radius=10000&type=rv_park&key=AIzaSyCietasdfasdfasdfasdfxzD65Uc19X6DgrJFumdi-nCZYSHjg");
            GooglePlacesResponse gpr = (GooglePlacesResponse)JsonConvert.DeserializeObject<GooglePlacesResponse>(jsonStr);
            Response.Write(gpr.status + "<br><br>");
            foreach (results r in gpr.results)
                {
                
                Response.Write
                    (r.name + " "  + 
                     r.geometry.location.lat + " " + 
                     r.geometry.location.lng + " " +
                     r.reference + " " +
                     r.vicinity  + " " +                         
                     "<br><br>");
            }

         } 
        public class GooglePlacesResponse
        {
            public string status { get; set; }
            public results[] results { get; set; }
        }
        public class results
        {
            public geometry geometry { get; set; }
            

Open in new window

0
I want to use c# library, api to filter by  e.g. rv_park place type. Can you show me the sample codes in c# with asp.net/mvc?

https://developers.google.com/places/supported_types
0
Where can i get api getting information for city's profile picture (just 1) and city's demographic description?  US only
e.g. I have beverly hill and I want to get one city picture and description.

I use c#, mvc.

Thanks
0
Is there a way to recover the password on a Word VBA Project using programming code? My file format is .dot. A Lot of recovery tools available in online but need to pay for those products I'm a student not able to pay so I need to recover or view my VBA project .dot file forgot password using code. Is it possible in code using .net programming or VBA code or any other programming codes?
0
Trying to show alert error message from my controller.  ASP.NET Core

Here is the code from my controller

[HttpPost]
        public async Task<OkObjectResult> GetSearchCases(CancellationToken token, int search)
        {

            using (CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(_hostStopping, token))
            {
                MyCaseViewModel mySearch = new MyCaseViewModel();
                var mySearchCases = _mapper.Map<List<MyCaseViewModel>>(await _myCasesService.GetSearchCasesAsync(cts.Token, search));
                if (mySearchCases.Count == 0)
                {
                    TempData["message"] = "Error";
                    return Ok(View());
                }
                else
                { return Ok(mySearchCases); }

            }

        }

Open in new window


As you can see from the above snippet I want to go back to the view if the count == 0 and show the error message. But I am not getting redirected to the view.

Here is code from my view

@{
    ViewData["Title"] = "Home Page";
}
@{
    if (TempData["message"] != null)
    {
        <script type="text/javascript">
        alert(@Html.Raw((TempData["message"])));
        </script>
    }

}
@section Scripts {
    <script src="~/js/my-cases.js" asp-append-version="true"></script>
    <script src="~/js/searchCases.js" asp-append-version="true"></script>
}
<h1>My Cases</h1>
@*<button id="take-next-case" class="btn btn-primary">Take Next Case</button>*@
<div class="row">
    <div id="case-status" class="col-4">
        <button id="take-next-case" class="btn btn-primary">Take Next Case</button>
    </div>
    <div class="col-4"></div>

    <div class="col-4">
        @*@Html.TextBox("AccountNumber", null, new { autocomplete = "off", maxlength = 20 })*@
        <button id="mainSearch" class="btn btn-primary">Search</button>
        <span class="fa fa-search"></span>
        <input id="search-text-box" type="text" placeholder="Search">
        <span id="errMsgAccNumber"></span>

    </div>

</div>
<div id="my-cases"></div>

Open in new window

0
Hi Experts,

When the following function runs, the windows event viewer is logging the attached error.  Any help is greatly appriciated!  

public void EndCheckForEisEmails(IAsyncResult result) {
                  var response = ((ServiceResponsePaged<EisEmail>)(((ChannelInvokeAsyncResult)result).Result));
                  if (response.Status == ResponseStatus.Success) {
                        var baseUrl = (string) result.AsyncState;
                        //We have to hit our own api to get a valid request context so that we can trigger the rule. Currently we have no request context
                var apiUrl = string.Format("{0}/api/siteevent/SendEisEmails", baseUrl);

Thanks in advance.
                        var emails = response.PagedData;
                        var jsonFormatter = new JsonMediaTypeFormatter();
                        var client = new HttpClient();
                        //var responseMessage = client.GetAsync("RecyclingClaimsProcessed");
                        const int numberOfItemsToprocess = 20;
                int pages = (emails.Count() / numberOfItemsToprocess) + 1;
                for (var i = 0; i < pages; i++) {
                    var responseMessage =
                        client.PostAsync(apiUrl, emails.Skip(i*numberOfItemsToprocess).Take(numberOfItemsToprocess).ToArray(),
                            jsonFormatter).Result;
                              
                    //This forces a pause, this is by design, we don't want to create too many requests.
                    if (!responseMessage.IsSuccessStatusCode) {
                        Logger.Error("Error while trying to post to …
0
Cloud Class® Course: Microsoft Exchange Server
LVL 12
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Hi Guys,
C# - IIS - Windows Server 2012
I am trying to execute a .exe file using a button on my Web Application, as a test first I have this code

            System.Diagnostics.Process process1 = new System.Diagnostics.Process();
            process1.StartInfo.FileName = @"notepad.exe";
            process1.Start();

Open in new window

in Task Manager, I can see Notepad is executed under "network Services"

Next i changed the above code to
            System.Diagnostics.Process process1 = new System.Diagnostics.Process();
            process1.StartInfo.FileName = @"MYOWN.exe";
            process1.Start();

Open in new window


no longer executes! MYOWN.EXE is in Windows/system32 folder

Can you please help.

Thank you,
0
Need to set itextSharp Acrofields to bold

            string OutPage =  @"C:\PDF\S3.pdf";
            string pdfTemplate = @"C:\PDF\S2.pdf";
            PdfReader pdfReader = new PdfReader(pdfTemplate);
            PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(OutPage, FileMode.Create));

            af.SetField("V1", "1");

            af.SetFieldProperty(   <<<<<< Need bold
0
I have  C# class from an XSD that includes several decimal fields that are in the output XML structure.  When I assign a decimal numeric value to them, all works fine.  The issue is that when the XML serializer class outputs the values, it puts 4 decimal places and I only want 2 as anything more than 2 is considered an invalid value by the program importing this XML file.

Sample below of the output XML file.  In all cases of <TotalTaxDol>, <CreditCardAmount>, <UnitPrice>, <TaxDols>, and <PriceExtension>, the output field should only have 2 decimal places, not 4.

TicketData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Ticket>
    <TransType>CRD</TransType>
    <SalesLocation>10</SalesLocation>
    <TransDate>20180621</TransDate>
    <TicketReference>fe9b61</TicketReference>
    <PrimarySalesperson>154</PrimarySalesperson>
    <ClerkNum>154</ClerkNum>
    <CustomerNum>10020754</CustomerNum>
    <TotalTaxDol>12.4700</TotalTaxDol>
    <CreditCard>
      <CardType>VISA</CardType>
      <CreditCardAmount>229.3700</CreditCardAmount>
    </CreditCard>
    <TicketLine>
      <ItemNum>DRD0042</ItemNum>
      <QtySold>1</QtySold>
      <UnitPrice>99.0000</UnitPrice>
      <PriceExtension>99.0000</PriceExtension>
      <TaxDols>5.6900</TaxDols>
      <TaxableFlag>Y</TaxableFlag>
    </TicketLine>
    <TicketLine>
      <ItemNum>SASH0007</ItemNum>
      <QtySold>2</QtySold>
      …
0
c# how to compare two XML files to find the difference and need to traverse each and every node and detects mismatch values
0
I am an Access programmer. I posted a question to convert access application to web based.  Now I am planning to move to web development. I came to know there is no way you can convert or move directly to web based programs.
I appreciate if you show some guidelines to start a web program (as if I am new to development).
Appreciate your help.
0
Hi all

I made an Visual Studio MVC webpage, which will be used to IT Equipment rental management.

I want a specific text input field "Name" to auto-complete or auto search for user firstname and lastname from Active Directory.

For exampel : if i wrote "Jo" then the text input field will show all names starts with "Jo" where we can pick the right name and then use this on "Name" text input field.

I have search on the web about how to achieve this, but couldn't find any great article about this.

If i want to achieve this, what is the best way to do it?

The site is on our intranet network, its inside our organization.

Regards

Erneeraq Fleischer
0

C#

93K

Solutions

25K

Contributors

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).