We help IT Professionals succeed at work.

.NET Programming

134K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

I have a side project in Web Forms that I want to upgrade to .Net Core and Angular on my own time.  I'm using VS 2019.

1. I'm following this example   https://www.c-sharpcorner.com/article/create-angular-8-application-with-asp-net-core-3-0/

2. I installed npm

3. Installed Angular 9. I see this

ee1.png
4. I created the project. Looking at package.json...why do I see Angular 8? I see this. Is this OK?
ee2.png
0
I am just a beginner in Android. I have to call a web service which I have develop in .NET from Android Studio.  I found lots of code from google but still unable to figure out an issue
Here is my code I don't know if it's correct
public class MainActivity extends AppCompatActivity {

    EditText LoginText;

    String SOAP_ACTION = "https://mywebsite.com/ReadLogin";
    String METHOD_NAME = "ReadLogin";
    String namespace = "https://mywebsite.com/";
    String url = "https://mywebsite/login.asmx";

public void checkLogin(View view) {
        String login = LoginText.getText().toString();
        RequestParams params = new RequestParams();
        if (isNotNull(login)) {
            //params.put("username", login);
            call();
            //invokeWS(params);
        }
        else {
            Toast.makeText(getApplicationContext(), "Please enter valid email", Toast.LENGTH_LONG).show();
        }
    }


public void call()
    {
        try {

            SoapObject request = new SoapObject(namespace, METHOD_NAME);

            request.addProperty("username", "abc");

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            //envelope.dotNet=true;
            envelope.setOutputSoapObject(request);

            HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
            androidHttpTransport.debug = true;

            androidHttpTransport.call(SOAP_ACTION, envelope);

            

Open in new window

0
Hello, i'm trying to learn the basics of VB.
I have installed Visual Studio 2019
I have installed MySQL server and created a test db with a table and column.
I have connected the studio to MySQL successfully
I'd like to master creating a form and inserting, updating and displaying the contents of the db table.

I'm struggling to find a decent video tutorial of this. like how to program the save button and insert it into the db.

All the videos i find are either in very bad English or they describe very different methods from each other so i'm not sure which one i should be following.

can someone point me towards some good material please?
thanks
zac
0
I am trying to populate a datagridview from a datatable but I don't want to bind it to the datatable. With the below code it's only displaying data in the last row (see attached picture). There are 5 records in the table. When I single step through the code and watch the row count is changing and the data is changing.

        Dim CheckUser As DataTable, intRow As Integer = 0

        CheckUser = ReadDataFromDB("SELECT * FROM users;", False)

        For Each row In CheckUser.Rows

            If Not String.IsNullOrEmpty(row("UserID").ToString) Then
                'DGridVUsers.CurrentRow.Cells(0).Value = row("UserID").ToString
                ' DGridVUsers.Rows(intRow).Cells(0).Value = row("UserID").ToString
                With DGridVUsers
                    .Rows(.Rows.Count - 1).Cells("UserID").Value = row("UserID").ToString
                    .Rows.Add()
                End With
            End If
            intRow += 1
        NextDatgridview Last Row Only
0
using C# remove the root node in an xml
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.w3.org/2001/XMLSchema-instance"><Member xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <LastName>Bond</LastName>
  <FirstName>James</FirstName>
  <AltKey>000011101</AltKey>
  <HCFANbr>000011101</HCFANbr>
  <ContractNbr>000011101</ContractNbr>
  <YmdBirth>2001-06-14T00:00:00</YmdBirth>
</Member></string>      

I want to remove
<string xmlns="http://www.w3.org/2001/XMLSchema-instance">
and
</string>      
so it will look like this:

<?xml version="1.0" encoding="utf-8"?>
<Member xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <LastName>Bond</LastName>
  <FirstName>James</FirstName>
  <AltKey>000011101</AltKey>
  <HCFANbr>000011101</HCFANbr>
  <ContractNbr>000011101</ContractNbr>
  <YmdBirth>2001-06-14T00:00:00</YmdBirth>
</Member>
0
The owner of the company has been working on upgrading the Windows Forms application for the past 5 years. He wrote the first one in 2002 with Web Services and he decided he wants a new version using new look-and-feel with WCF and not Web Services.

He's  given me the code to continue with this insanity :)

Code compiles, runs, I can log in but then code doesn't connect to WCF. I put debug steps in WCF and it doesn't even stop in the code.

I'll go step by step

1. This is how the project is set up :

ee1.png
2. I run the code, log in, try some functionality and I get this error:

ee2.png
3.  Looked at IIS Express and I see these running
ee3.png
4. I don't see http://localhost:63680/SBTechTeamMembersService.svc in the list

5. I tried http://localhost:53457/ (this is in the list in step #3) in the browser and I see a list of code
    I tried  http://localhost:63680/ and I get page cannot be displayed.


So, the WCF is not running? If so, how can I start it? why the other WCFs are in the list and this one isn't?
0
Dear Experts
We have decided to develop customized application using .NET core frame work with Visual Studio using C# and for reports and analytics we are going to use  PowerBI report server (on-premise).Please help me understand pros and cons on deciding the database that is should we have to go for  MS SQL or PostgreSQL
0
Dear Experts
Based on the business processes we have identified solution development to be done in .NET Core framework with  Visual Studio using C# and MSSQL we have decided power BI for reporting and analytics( on-premise power BI report server) but customer have asked if possible to consider PostgreSQL, please help to understand on following
1.Application developing using .NET Core framework with Visual Studio using C# instead of MSSQL for database going for PostgreSQL will there be any complications, limitations and some thing that we have to comprise.
2.If we chose PostgreSQL as database server and front end application .NET Core framework with Visual Studio using C# and develop application but using power BI for reporting and analytics is there going to be any challenges, does power BI has connector to interface with PostgreSQL please let us know ,
Please help on above 1 and 2
0
Can we create a extension method ToVauleOrDefault on the DataReader, so when we do reader.GetValue(ordinalId).ToValueOrDefault<string>, within that method it will check null and then convert using oracle datereader

public static T ValueOrDefault<T>(this XElement element, T defaultValue = default(T))
        {
            if (element == null)
            {
                return defaultValue;
            }

            return element.Value.To(defaultValue);
        }

Open in new window

0
I think the answer to this is "yes" but I want to double check.

I'm working on code from 2002. It's .Net Frameowork 4.0. This is Windows Forms. We have to install the application on client machines manually...one by one.

I changed the Framework to 4.6.1. Compiled and all is good.

My manager says we can't deploy/install the upgrade on client's environments without installing  Framework 4.6.1 on client machines.

Do we need to install 4.6.1 n client machines?
0
Dear Experts
Would like to know the sequence of software development methodology, please correct me on the below if found it incorrect or sequence found to be changed
1.      Requirement study and documentation by business analyst
2.      Solution architect will convert the requirement document to design document/functional specs
3.      Solution architect will prepare the technical specifications for developer to start developing
4.      Test strategy will be prepared by QA team
5.      Testers -
User acceptance will be done by customer
Please let me know is the above in sequence and is there anything which can go parallel or one after another also where does UI/UX come into in the above sequence also document writing for user manual or operational manual
0
I am trying to write a program using C# and WPF to download all images from a web page.

In my XAML I added the following control:

<WebBrowser x:Name="scrapeWebBrowser" Grid.Column="1" Grid.Row="1"/>

Open in new window


For testing, I created a test button that does the following:

scrapeWebBrowser.Navigate("http://yahoo.com");
HTMLDocument objHtmlDocument = (HTMLDocument)scrapeWebBrowser.Document;

foreach (IHTMLElementCollection imageElements in objHtmlDocument.images)
{
//I am not sure what to do here.  I am trying to get the reference to the image.
}

Open in new window


How do I get a reference in my code above?  Once I have the reference, how do I download it?

Any direction would be greatly appreciated.      

Many Thanks!
0
Why does this code deadlock?

I created a simple WPF project with a single button, and this is the button click code.

If I comment out the SetSynchronizationContext then it works. (Which brings up another question, why doesn't it crash complaining I'm not on a STA thread for the second MessageBox, because after the await it resumes on a different thread.)

With the SetSynchronizationContext line, it seems to deadlock at the await statement, I'm guessing it's unable to resume on the same thread it started on. Is there a hidden .Join() or .Wait() somewhere blocking the thread it started on? Is the thread it started on blocked somehow? (Or is it gone?)

private void Button_Click(object sender, RoutedEventArgs e)
{
    // Create a thread
    Thread newWindowThread = new Thread(new ThreadStart(async () =>
    {
        MessageBox.Show("Initial ThreadId=" + Thread.CurrentThread.ManagedThreadId.ToString());
        SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext());
        await DoAsync();
        MessageBox.Show("Now ThreadId2=" + Thread.CurrentThread.ManagedThreadId.ToString());
    }));
    newWindowThread.SetApartmentState(ApartmentState.STA);
    newWindowThread.IsBackground = true;
    newWindowThread.Start();
}

private async Task DoAsync()
{
    await Task.Delay(1000);
}

Open in new window

0
C#.MVC What Controller for MP3 Upload Web Service?

I need a web service that accepts an MP3 file and kicks off a series of steps. So, what is the best type of Controller object to use?

And what kinds of configurations will be best for this? Does this require configurations available only through WCF?

Thanks
0
Can Entity Framework be used along with the SQL Server CLR?

I will use the CLR to have a Database triggered call to my C#.NET source code. But, I lately only use Entity Framework in C# to query and update the SQL DB.

Does this work? It's seems like it could be very problematic. But, on the other hand, if my C# code is sure to close all DB connection before returning a value, I SUPPOSE this could be a logical design paradigm.

Please feel free to comment.

Thanks
0
My References.cs file (generated by my recent addition of a third party WSDL reference) is very large.  664,293 lines.  Often when I open the file, the Visual Studio 2019 IDE crashes and re-opens.

I guess I am taxing my Windos 10 OS by opening the file?

In Task Manager, CPU % usage jumps when I scroll the file.  So does RAM usage.  I can clearly see that the file is impacting my system.

But my question is not IF the file is large, but what to do about it?

Can the file be compiled somehow, so I still have access to the web methods in the WSDL without having to actually OPEN the References.cs file?  I mean, I know I don't have to OPEN the References.cs file in order to reference the methods, but I can't just delete the file, right?  I want to compress it or compile it or do something so it reduces the impact on my system.
0
I am trying to combine a series of rtf into a single one for display into a richtextbox.rtf property.

I'm using the following code to trim the first and last characters so they all display at once but the last RTF is being ignored.  Everything up until the last rtf is displaying perfectly.  After a couple of hours of fiddling I still can't figure out how to properly concatenate and terminate these things.

Here's the code to remove trailing characters of the first RTF and leading character of subsequent RTFs then add in the trailing characters at the end.  I think I tried various combinations thereof but I'm hoping someone with more RTF knowledge can point me in the right direction?



Thanks

                For i = 0 To dsRM.Tables("Narratives").Rows.Count - 1
                    If i = 0 Then
                        NarrativeText += dsRM.Tables("Narratives").Rows(i)("NarrativeRTF")
                        NarrativeText = NarrativeText.Substring(0, NarrativeText.Length - 3)
                        trailingthree = NarrativeText.Substring(NarrativeText.Length - 3)
                    End If


                    If i > 0 Then
                        tempNar = dsRM.Tables("Narratives").Rows(i)("NarrativeRTF")
                        NarrativeText += tempNar.Substring(1, tempNar.Length - 1)
                    End If

                Next
                NarrativeText += trailingthree
                MsgBox("added last r} back in")

                …
0
Dear Experts
We have to develop web application using .Net and SQL and to be hosted on premises behind firewall and provide access to the customers, their main concern is about security,  for IT/IS level few things I can think install SSL, Application will have login credentials, windows AD integration,  additional layer of protection with 2 factor authentication, server level antivirus. OS level hardening.
would like to understand application front-end level what measures to be taken by the software development team similarly at data base level what security measures to the taken and any other factors from the application level please help with the list of things to be considered
0
I am subclassing a TextBox so it will disallow cut, copy, and paste actions. I'd like it to show a customized message similar to the one seen when you attempt to copy text from a regular TextBox that has the PasswordChar property set.
PasswordCharI've provided a sample of the overridden WndProc method which right now only sets a ToolTip. This is not what I want. I want a popup bubble like the picture (including icon, title, and message text) that will disappear after a few seconds.
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WM_COPY:
                    if (AllowClipboard)
                    {
                        base.WndProc(ref m);
                    }
                    else
                    {
                        _toolTip.SetToolTip(this, "Illegal Copy Operation. You will now be arrested!");
                    }
                    break;
                case WM_PASTE:
                    if (AllowClipboard)
                    {
                        base.WndProc(ref m);
                    }
                    else
                    {
                        _toolTip.SetToolTip(this, "Illegal Paste Operation. You will now be arrested!");
                    }
                    break;
                case WM_CUT:
                    if (AllowClipboard)
                    {
                        base.WndProc(ref m);
                    }
          

Open in new window

0
dear All

when i publish/recompiled a web application i got the below error:
Could not load file or assembly 'App_Web_hfkovznn, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

but if i publish without precompile the application , web application will be opeend correctly please advise.
0
I have a string (a name) that has been HTMLEncoded (to prevent cross site scripting) and is being put in the database correctly. However when its being pulled out its showing up with the ASCII representation. I need to undo the encoding effect. I've looked around a bit and have seen some things on HTMLDecode, but that doesn't seem to exist/work. I get a message saying HTMLDecode does not exist in the current context. How do I solve this?
0
Need to configure IIS Express - localhost

I installed Visual Studio onto Windows 10. Then, I created a .NET MVC application, which compiles okay, but fails when I try and run it.

I have not configured IIS Express and am not even sure it is there.

LocalHost not reachable
How do I open IIS Express on Windows 10?

I need to configure the Virtual Directory, etc.


Here are my settings...
{
  "iisSettings": {
    "windowsAuthentication": false, 
    "anonymousAuthentication": true, 
    "iisExpress": {
      "applicationUrl": "http://localhost:61938",
      "sslPort": 44364
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "SampleWebApplication1": {
      "commandName": "Project",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

Open in new window


Thanks.
0
Which .NET Technologies to install? (.NET CORE?)

I have a Windows 10 VDI (in the cloud) and need to install the proper tools to build my hobby .NET program web service. So, please tell me if I should consider .NET CORE and provide any other advice on architecture.

I need to create a back-end web service which calls some outside web services in parallel. One web service call will spawn 3 or 4 outbound web service calls, each with a unique response time.

Also, I need to use an ORM, most likely Entity Framework 6 (or higher). That means I should probably get SQL Express.

So, the tools I see using are:
Visual Studio Community Edition 2019
SQL Server Express 2019
Entity Framework (Core or EF6) ?

What suggestions can you make?

I want the program to be a great learning tool for me. And would learn .NET Core, if there was value to my particular web service demo.

I hope to hear your thoughts.

Thanks.
0
I am a noob when it comes to .Net Core and I was asked to upgrade an existing project from Core 2.2 to 3.1. I have been slowly working though the issues but this one I can not find any help on.

I am getting an error:

CS1061 'IHtmlGrid' does not contain a definition for 'WithFooter' and no accessible extension method 'WithFooter' accepting a first argument of type 'IHtmlGrid' could be found (are you missing a using directive or an assembly reference?)

Here is the full page code from my FollowupOnTimeGrid.cshtml:


@(Html.Grid(Model)
    .Build(c =>
    {
        c.Add(m => m.SurveyDateRange).Titled("Survey Period").InitialSort(GridSortOrder.Asc);
        c.Add(m => m.Due);
        c.Add(m => String.Format("{0} ({1:f2}%)", m.OnTime, m.Due == 0 ? 0 
           : Math.Round((((double)m.OnTime) / m.Due) * 100.0, 2)))
                 .Titled("Surveys Taken on Time (N (%))");
    })
    .Css("table-striped table-bordered table-hover")
    .Named("FollowupOnTimeGrid")
    .Empty("No Records Found!")
    .WithFooter("_FollowupOnTimeGridFooter")
)

Open in new window

0
Hi Experts!

Need your help with the following query.

In jobHistories, for each City, for each Perid, how would you filter the linq query to return the following condition: if Hired = "Y" then select one of the record with Hired = "Y" and ignore the rest of the records for PerId. If there are no Hired= "Y" then just select one record for the PerId
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject2
{

    [TestClass]
    public class UnitTest3
    {
        internal class JobHistory
        {
            public int PerId;
            public string JobTitle;
            public string Address;
            public string Hired;
            public string City;
            public Nullable<System.DateTime> CreatedOn;
        }

        [TestMethod]
        public void Extract_HiredThenEverythingElse_CorrectPicks2()

        {
            // Arrange
            List<JobHistory> jobHistories = new List<JobHistory>()
            {
                new JobHistory() {PerId = 1, JobTitle = "Knight", Address = "123 Street", Hired = "Y", City = "Yokohama", CreatedOn = new DateTime(2011, 6, 1)},
                new JobHistory() {PerId = 1, JobTitle = "Cook", Address = "234 Street", Hired = "Y", City = "Yokohama", CreatedOn = new DateTime(2012, 6, 1)},
                new JobHistory() {PerId = 1, JobTitle = "Mechanic", Address = "345 Street", Hired = "N", City = "Yokohama", CreatedOn = 

Open in new window

0

.NET Programming

134K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.