.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.

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

Sign up to Post

Hi

How do you orderBy ReleeseDate  when returning person Information from the TMDB API

This returns the Movie Credits but isn't ordered
                     TMDbClient client = new TMDbClient("API KEY");

                     public DateTime dateTime { get; set; }
            // Set Default Date
            dateTime = DateTime.Parse("01 / 01 / 0001");
                var PersonKnownFor = client.GetPersonMovieCreditsAsync(TMDB_id).Result;
                foreach(var PKF in PersonKnownFor.Cast)
                {
                    
                    if (PKF.ReleaseDate != null)
                    {
                        dateTime = DateTime.Parse(PKF.ReleaseDate.ToString());
                    }

                }

Open in new window



                var PersonKnownFor = client.GetPersonMovieCreditsAsync(TMDB_id).Result;
                foreach(var PKF in PersonKnownFor.Cast.OrderBy(PersonKnownFor.Cast.d)  // I think you order it here but can't see how
                 {
                    
                    if (PKF.ReleaseDate != null)
                    {
                        dateTime = DateTime.Parse(PKF.ReleaseDate.ToString());
                    }
                  int Year = dateTime.Year;
                

Open in new window


Also

Hovering over ReleaseDate suggests it is a System Date Time object but to get at the year I had to do above unsure why
0
In my windows forms application, I have a list of items <Container> which are populated into a datagridview. Each container has a unique ID. As follows:

ui1
In the datagridview, I have a "Modify" button column that when clicked, transfers the properties of the selected container onto the textbox controls in my UI. As follows:

ui2
Question: Given the above, how do I update the properties of a container within my list?

Background code:

Container class:

public class Container
    {
        #region Properties

        // Unique container ID
        public string ContainerID { get; set; }
        // Container description
        public string Description { get; set; }
        // Container payload capacity - weight
        public double CapacityWeight { get; set; }
        // Container payload capacity - cube
        public double CapacityCube { get; set; }
        
        #endregion  

        #region Constructor

        // Default constructor
        public Container()
        {
            ContainerID = Extension.NewID();
        }

        #endregion
    }

Open in new window


List initialization:

// Create an initial arbitrary list of containers to choose from
BindingList<Container> Containers = new BindingList<Container>();

Open in new window


private void initContainers()
        {
            // Add some containers to the container list
            Containers.Add(new Container() { Description = "20FT GENERAL PURPOSE", CapacityWeight = 23.4, CapacityCube = 30 });
            Containers.Add(new Container() { Description = "40FT GENERAL PURPOSE", CapacityWeight = 24.5, CapacityCube = 60 });
            Containers.Add(new Container() { Description = "40FT GENERAL PURPOSE - HIGH CUBE", CapacityWeight = 25.0, CapacityCube = 70 });
            Containers.Add(new Container() { Description = "US CHEP TWO-WAY PALLET", CapacityWeight = 1.524, CapacityCube = 1.8 });
        }

Open in new window

0
Hi

Using the TMDB API
I have a User Control on a winform with a TvTitleLbl Label & TvPosterPictureBox

I've been strangling to extract the year from KnownForTV.FirstAirDate having finally got it working, is this the best way?
I'm now getting Error, "Object reference not set to an instance of an object" on both the Label & PictureBox when trying to set it's properties unsure why ?

TvTit.jpg
the proper lable.text will be "TvTitleLbl.Text = "TV: " + pKFTV.Name + " ( " + year.ToString() + " )";"  shortened it to debug

KnownForTV.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MoviesDataModel;
using TMDbLib.Client;
using TMDbLib.Objects.General;
using TMDbLib.Objects.Movies;
using TMDbLib.Objects.TvShows;
using TMDbLib.Objects.Search;
using TMDbLib.Objects.People;

namespace FilmsDB
{
    public partial class KnownForTV : UserControl
    {
        TMDbClient client = new TMDbClient("API KEY");
        const string ImgPath = @"E:\Media\thumbs\Movies\";
        const string ImgURL = "https://image.tmdb.org/t/p/";
        const string OriginalImgPath = "http://image.tmdb.org/t/p/original";
        public string ThumbPhotoPath { get; set; }
        public string FullPhotoPath { get; set; }
        private KnownForTv pKFTV;



        public KnownForTV(KnownForTv pKFTV)

Open in new window

0
Convert a string to date format :
dd-mm-yyyy
in vb.net

Thanks
0
Find Time1 is greater than Time2 provided
example:
Dim dateday as date

Time1: 9:41
Time2: 1:00

if Time1 is greater than Time2 then add a day to the date.
0
Hello Experts,

I'm new to MVC devlopment, I was using Viewbag to pass the data from my controller to JS(jquery function). I want to know how can I read the List data and then assign to my grid. This is the sample code, I was getting error while reading the ViewBag.MyList in my JS function. How can I do this so I can get the list object. Later part once I get the list object, then I will bind the data with the grid.

Controller
public async Task<ActionResult> TestData(
string resp = "";
 var test = new List<Tuple<int, string>>();
test.Add(new Tuple<int, string>(1, 'R1'));
test.Add(new Tuple<int, string>(2, 'R2'));

if (test.Count > 0) {
ViewBag.MyList= Newtonsoft.Json.JsonConvert.SerializeObject(test);
}

resp = "test";
}

Open in new window


JavaScript
$.ajax({
        type: 'post',
        url: url,
        processData: false,
        contentType: false,
        data: files,
        success: function (response) {

 if (response == 'test')
{
var testList= JSON.parse('@Html.Raw(ViewBag.MyList)');
}
}

Open in new window

0
I am trying to parse a return value of the date.now

I have the following:

'On a button control I have the following

Dim date1 as Date = Date.now

'I would like to parse the returned value # 9/5/2019 01:27:04 PM#

Open in new window


The format I am trying to get is the following
<min,hour,date,weekday,month,year>

So the returned value above would look like:

<27,01,05,4,9,2019>

Any help would be amazing.
0
I think this is probably linked to previous question  

Using TMDB API I have a ListView on a Winform showing a list of people from a search

I'm adding each Person to the item tag but am unable to retrieve the properties of the tag on selection

Thinking I needed to cast it to an object I created  public class FoundPerson by Paste as JSON form developers.themoviedb API

        private void DoSearch()
        {
            TMDbClient client = new TMDbClient("<API KEY>");
            var People = client.SearchPersonAsync(ActorName).Result;
            int id = default(int);
            foreach (var person in People.Results)
            {
                id = person.Id;
                if (person.ProfilePath == null)
                {
                    ThumbPhotoPath = ImgPath + "JohnWayneSml.png";
                    FullPhotoPath = ImgPath + "JohnWayneBig.png";

                }
                else
                {
                    ThumbPhotoPath = ImgURL + "w45" + person.ProfilePath;
                    FullPhotoPath = ImgURL + "original" + person.ProfilePath;
                }


                if (!imgResults.Images.ContainsKey(ThumbPhotoPath))
                    imgResults.Images.Add(ThumbPhotoPath, LoadImage(ThumbPhotoPath));
                ListViewItem item = new 

Open in new window

0
First time poster, hopefully it's okay.

I am developing a windows forms desktop application and am having some difficulty with my class design.  Based on the following background, I am seeking expert feedback and guidance on what I need to add to my shipment container class to allow for adding a container to a shipment?

As this is an ongoing project that will require further input, I thought it would be best to provide some background information to help articulate it's purpose.

Application structure and functional usage descriptions are defined follows:
 
Shipment
- Create a shipment.
- Update the attributes of a shipment.
- Delete a shipment.
- Provide a summary of the shipment details. i.e. Container count, Package count, Total weight, Total cube...

Shipment Container
- Create + Add a container to a shipment.
- Update the attributes of a container in a shipment.
- Delete a container from a shipment.
- List all containers in a shipment.
- List all packing quantities in a container.
- Track packing quantities and load utilization rates for each container.
- Provide a summary of load quantities and utilization rates for each container. i.e. Package count, Load weight, Load cube...

Shipment Container Package
- Create + Add a quantity of packages to a container.
- Update the attributes of a package container in a shipment.
- Delete a package from a container and/or all containers.
- List all packing quantities in a …
0
Hi,

I'm new to xml.  May I know whether there exist any xml generator in the market?  No matter it need to pay or it is free of charge.

That is, if I provide the generator all those schema for the xml together with the data that need to be contained in the xml, the generator will generate the appropriate xml out.   Do such xml generator exist in the market?

Kindly please help.

Cheers
Stanley
0
I am using .NET Reflection to read fields on an application window.  The Dynamics GP ERP application I'm working with uses proprietary object types, so my reflection code is casting the fields in order to read them.

This is code that successfully reads the value of a window field of type string:

field1Value = ((Microsoft.Dexterity.Bridge.FieldWithEvents<string>)dynamicsWindowType.GetProperty(windowField1).GetValue(dynamicsWindow, null)).Value;

Open in new window


Note the cast to the FieldWithEvents<string> data type.  This allows me to store the field value into a .NET string.

This line of code works fine on string fields, but does not work on other field types, such as Int or Decimal.  For each data type, I would need to use a different cast, like so:

Microsoft.Dexterity.Bridge.FieldWithEvents<int>
Microsoft.Dexterity.Bridge.FieldWithEvents<decimal>


I would like to use reflection to get the field type at runtime and cast the field value so that I don't have to hard code the field type as string, decimal, int, etc.

For example, something like this pseudo code, where genericType would be the type of the field being read:

field1Value = ((Microsoft.Dexterity.Bridge.FieldWithEvents<genericType>)dynamicsWindowType.GetProperty(windowField1).GetValue(dynamicsWindow, null)).Value;

Open in new window


or perhaps

field1Value = ((genericType)dynamicsWindowType.GetProperty(windowField1).GetValue(dynamicsWindow, null)).Value;

Open in new window



I've looked into Generic Types, but I am not sure how to use them in this scenario.  I've tried variations like this:


Open in new window

1
I have added some extra fields to the aspnet_user tables, one of the fields is a Boolean - ResetPassword that is set to true when user is first created by the Admin.

When the user logs in if the field is a Boolean is sends user to change password - once the user successfully changes their password I want to update the field to false - how do i update a field in the Identity User table easily ?

Thanks
0
I have a need to perform two functions  to retrieve information about a person i'm guessing the error  is the same reason?

1st if the person ID isn't known I need to do a search by name
using the API  even if correct it gives back several hits
However it dose reveal what a person is "known_for" which is some of the information I'm after as is the person ID
You need the person's ID to reveal details like BIO

Is it possible to chain queries together?

In the code bellow I'm the errors listed

using System;

using TMDbLib.Client;
using TMDbLib.Objects.General;
using TMDbLib.Objects.Movies;
using TMDbLib.Objects.TvShows;
using TMDbLib.Objects.Search;

namespace TMDBTest
{
    class Program
    {
        static void Main(string[] args)
        {
        // Access to The Movie DB API
        TMDbClient client = new TMDbClient("2c8a02fa36fb5299dcd97bbc84609899");
            Console.WriteLine("Hello World!");
            var People = client.SearchPersonAsync("jessica alba").Result;

            foreach(var Person in People)
            {

            }
            // assuming you know the id of the  person

            

            var PersonKF = client.GetCreditsAsync("56731").Result;
            foreach(var PNF in PersonKF)
            {

            }

        }
    }
}

Open in new window


Errors
Error	CS1579	foreach statement cannot operate on variables of type 'SearchContainer<SearchPerson>' because 'SearchContainer<SearchPerson>' does not contain a public instance definition for 'GetEnumerator'


Error	CS1579	foreach statement cannot operate on variables of type 'Credit' because 'Credit' does not contain a public instance definition for 'GetEnumerator'	

Open in new window

0
Hello,
How to make a tabcontrol , tabheaders invisible.
I am using vb.net .

Thanks
0
Hello Experts,

I have a issue while inserting null into oracle database from .NET application. I have a field Phone  which is number in database, but want to insert null  when it's passed as parameter value and from application I also need to format the data(string value) and remove any symbols and insert just number.

E.g. 123-456-7890 should be 1234567890
0
I am getting the following error,
"There was an error while performing this operation. Details: Invalid application path"
when I click "Test Settings" on the "Basic Settings" in an IIS Web Site's application's Actions section. The Web Site itself doesn't get that error.
This is a Windows 2008 r2 server Version 6.1, Build 7601: Service Pack 1.
It is running IIS 7.5.7600.16385 (Yes, I know. But I have no choice.)

There was an application called SSI running a website called SSL that a vendor had setup on one of our servers. My company purchased the application and for reasons to lengthy, we have to setup the SSI application under a different Web Site.

I setup the new web site, EndCourseSurvey. (I'm a developer, not a server admin.)
  • The site bindings are https with IP addresses All Unassigned on Port 443.
  • The Host name field is disabled.
  • The SSL certificate is DigiCert SHA2 Extended Validation. It has a yellow warning next to Key Usage and Basic Constraints. (I don't know what that means but all our certificates seem to have that.)
  • Key Usage: Digital Signature, Key Encipherment (a0)
  • Basic Constraints: Subject Type=End Entity, Path Length Constraint=None

Under Basic Settings, the web site connects as the Application user with pass-through authentication.
When I click on Test Connection for the web site (not the application), the authentication passes with a green check. The …
0
Is this possible? We are migrating our api from .net to .net core and wondering if we can take the passwords as well.

I know we can get the password salt, but the hashing function in .net has to be different than .net core? How can we achieve this without asking 30k+ users to change their password? Worse case scenario we can do this but id rathet not if possible.
0
Hi
I'm trying to add items to a flowlayoutpanel  something like the picture

kate.JPG
I've managed a picture but the hover is failing because BigPicturePath is being overwritten
so
1. How do I use the picture.tag to pass the url into ThumbPictureBox_MouseHover method
2. How Do I adjust the linq query to order on movies.movielinkpersons.role

3. In order to create the picture example I'm guessing I'd need to create a 2 X 2 TableLayoutPanel with Col1 rowspan of 2 adding a Picture box to col1 a label to col2 row1 (with a click function) and a button to Col2 Row2

What concerns me is my form has a 3 column TableLayoutPanel with a second TableLayoutPanel  in the center column with the flowlayoutpanel   in 1 cell show here

FilmForm.JPG
In the code bellow GetCast is triggered on clicking a title  in a listview

        private void GetCast(int id)
        {
            using (var context = new MoviesEntities())
            {
                var Movies =  context.movielinkpersons.Where(p => p.movieId == id).ToList();
                int i = 1;
                foreach(var person in Movies)
                {
                    string Thumb = "";
                    if (person.person.profile_path == "/JohnWayneBig.png")
                    {
                        Thumb = ImgPath + "JohnWayneSml.png";
                        BigPicturePath = ImgPath + "JohnWayneBig.png";

                    }
                    else
                 

Open in new window

0
anyone works with Telerik controls? Im trying to bind a line type radchartview to an array using this code but the chart wont show:

  Dim radChart As New RadChartView

  radChart.DataSource = New Double() {1.4, 1.9, 3.6, 3.6, 4.1}

  Me.Controls.Add(radChart)
0
Hi
Building on an earlier question

I'm trying to create a Winforms Application

Although related I've split this into 2 questions

I'd like to create an Autocomplete to search   and filter the movies by actor/ person name

I've built Autocomplete in other languages  eg jQuery this is a two step process 1st a list of possible options 2nd  you have an OnSelect action I don't seem to be able to find similar in .Net  so the code bellow is running Loading the  Titles in ListView, if the entire name if correctly typed, with out being able to make a selection

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;
using MoviesDataModel;

namespace FilmsDB
{
    public partial class Form1 : Form
    {
        public string ImgPath = @"E:\Media\thumbs\Movies\";
        public Form1()
        {
            InitializeComponent();
            TitlesLV.View = View.Details;
            ColumnHeader columnHeader = new ColumnHeader();
            columnHeader.Text = "Film Title";
            columnHeader.TextAlign = HorizontalAlignment.Center;
            columnHeader.Width = -2;

            TitlesLV.Columns.Add(columnHeader);
            LoadMovies();
        }

        

Open in new window

0
Hi
Building on an earlier question

I'm trying to create a Winforms Application

Although related I've split this into 2 questions

I can run a query and add a list of All movie titles into a listview but when I click an item I cannot access movie properties to populate the form elements adding a watch to movie
MovieID.JPG
MovieID1.JPG
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MoviesDataModel;

namespace FilmsDB
{
    public partial class Form1 : Form
    {
        public string ImgPath = @"E:\Media\thumbs\Movies\";
        public Form1()
        {
            InitializeComponent();
            TitlesLV.View = View.Details;
            ColumnHeader columnHeader = new ColumnHeader();
            columnHeader.Text = "Film Title";
            columnHeader.TextAlign = HorizontalAlignment.Center;
            columnHeader.Width = -2;

            TitlesLV.Columns.Add(columnHeader);
            LoadMovies();
        }

        private void LoadMovies()
        {
            TitlesLV.Items.Clear();
            using (var context = new MoviesEntities())
            {
                //get a full list of all movies (will return everything from 

Open in new window

0
Hi I am getting the following error is my ASP.net web app when I click a GridView button. I am using .net framework 4.6.1. What would cause this

Server Error in '/' Application.
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +9935848
   System.Web.HttpRequest.FillInFormCollection() +415
   System.Web.HttpRequest.EnsureForm() +69
   System.Web.HttpRequest.get_Form() +13
   System.Web.HttpRequest.get_HasForm() +9932779
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +95
   System.Web.UI.Page.DeterminePostBackMode() +69
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +130

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3429.0
0
Hi All,

I want to access google drive folder and its files from application, .NET or PHP.

How could I do it?

Thank you.
0
Hi,

My response[0].Body[0].Content has the following value:
{"title":"StudentRecord", "students":[
					{"name":"Josh", "age":"45", "sex":"male}, 
					{"name":"James", "age":"18", "sex":"male}, 
					{"name":"Emily", "age":"25", "sex":"female}, 
					{"name":"Nate", "age":"33", "sex":"male}, 
					{"name":"Nichole", "age":"19", "sex":"female}, 
					{"name":"Janet", "age":"21", "sex":"female}
				      ]
}

Open in new window

What I want to do is remove all the students but the first and last ones from students array so that the result becomes
{"title":"StudentRecord", "students":[
					{"name":"Josh", "age":"45", "sex":"male}, 
					{"name":"Janet", "age":"21", "sex":"female}
				      ]
}

Open in new window


I tried like
var myObj = Newtonsoft.Json.Linq.JObject.Parse(response[0].Bocy[0].Content.ToString());
I know how to remove a property totally, but not partial values from the array.
I am also not sure if I have to convert it to JObject first since then I have to convert it back to the original type of response.

Is there any easier way to solve this issue?
0
I want to practice vb.net by creating a few applications.  I can't seem to find a free download that when i download contains vb.net. Where can i go to download this?
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.