.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

Building on previous  Questions  

I've been learning how to use ADO.NET Entity Data Model in a WinForms Using a movie Database I've included the model bellow

So far I've succeeded in doing select and updates I now need to add new data, Ultimately I'll need to add a new movie but that's to complex to start with

So Given File(s) can be associated with a movie via the   movielinkfile Database Table

How do I add a file and link it to a movie?

In SUDO code you'd
1 check file doesn't exists
2 Add the file.path Keep last ID
3 add entry to movielinkfile  with Last File ID & Movie ID

In .Net I'm assuming you create a File object see bellow but It doesn't like movie.id?

        private void AddFileBtn_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.InitialDirectory = MediaFiles;
            DialogResult dr = this.openFileDialog1.ShowDialog();
            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                foreach (String file in openFileDialog1.FileNames)
                {
                    if (File.Exists(file))
                    {
                        int FileID = CheckFileDB(file);
                        if (FileID == 0)
                        {
                            AddFileToDB(SelectedMovieID, file);
                        }


                    }
                

Open in new window

0
OWASP: Forgery and Phishing
LVL 13
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

I have a dropdownlist that I need the clientidmode to be static.

<asp:DropDownList ID="ddlClientTest" name="ddlClientTest" clientidmode="Static" CssClass="" runat="server">
        </asp:DropDownList>

Open in new window


I have defined it explicitly in the code in front as above.

However, when it is rendered it adds another name to the front like so:

<select name="ctl00$ContentBody$TeamSearchGridControl$ScreenNameControl$ClientComboControlFilter$ddlClientTest" id="ddlClientTest" name="ddlClientTest">

Open in new window


I'm trying to add a Trigger for a button on a different control and it complains it can't find the ddl, so I suspect, that it is because of this renaming of the name. I view source code and that's the only thing that looks off.

        Dim newtrigger As New AsyncPostBackTrigger
newtrigger.ControlID = "ddlClientTest"
 UpdatePanelTeamGrid.Triggers.Add(newtrigger)

Open in new window


The error is:
A control with ID 'ddlClientTest' could not be found for the trigger in UpdatePanel 'UpdatePanelTeamGrid'.
0
I am trying to move a large Visual Basic .NET project from VS 2008 to VS 2019 Community Edition. In VS 2019, I am getting huge numbers of errors like

Requested operation is not available because the runtime library function 'System.Runtime.CompilerServices.AccessedThroughPropertyAttribute..ctor' is not defined.

Other functions are named on other occasions, such as "System.Runtime.CompilerServices.DateTimeConstantAttribute..ctor".

Even more strangely, I'm getting error BC30002, "Type 'System.String' is not defined", and the same error for other types (Void, Int32, DateTime, Decimal, etc.).

Clearly, some sort of reference linking the Windows forms app to runtime modules isn't getting loaded, but I can't figure out what's missing. I've looked at the VS 2019 version and the VS 2008 version, and the project references seem to match. Can you offer suggestions of how to get them properly loaded, and eliminate the current 75,000(!) errors?
0
How to block emails in office 365 that are .com.XX..... Notice most of our malicious emails are coming from .com.XX address's... Example joesmith@test.com.kr .... I want to block anything that has something after the .com ....

Even better i would like to only allow .com or .net email to come thru but still block .com.XX and .net.XX etc...

Hope what i said made sense. Office 365 has alot of tools but a lot of common sense things they lack.
0
We are developing our first Angular application within our department.
We have employed to consultants to do the coding using Angular 8, I believe.
We are a MS Visual Studio shop.

The consultants claim it is easier for them to develop using VS Code vs VS.NET.


Why would this be? And why wouldn't .NET offer an equivalent experience?
0
Hello,
If anyone knows  in Csharp,how to convert string such as "1.0.2" to decimal or double. I tried below but it gives error.

Convert.ToDecimal("1.0.2")

'Convert.ToDecimal("1.0.2")'
threw an exception of type 'System.FormatException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233033
    HelpLink: null
    InnerException: null
    Message: "Input string was not in a correct format."
    Source: "mscorlib"
    StackTrace: "   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)\r\n   at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)\r\n   at System.Convert.ToDecimal(String value)"
    TargetSite: {Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)}
0
We have a console app which pulls data from rabbitMQ and then pushes via websocket (signalR) to web app

However we have noticed that when there is a small outage, there are many messages in the queue and it takes a while to catch up
What we need to do is process from Last message in queue backwards, then we could check the timestamp and see if its older than what was already sent and discard old data.
I read some old articles online that said LIFO is not supported by rabbitMQ

If not are there other queues/tech to look at?
Alternatively we could get all messages into c# and then flip the order, but as many messages are coming in at same time we'd opt for a more simple solution first if there is one
0
I have a Windows Forms application that is using a custom drawn window. On this form I have controls that simulate a normal Windows header and footer.

This little trick works great for passing mouse click events through to the underlying control
		private const int WM_NCHITTEST = 0x0084;
		private const int HTTRANSPARENT = (-1);

		protected override void WndProc(ref Message m)
		{
			if (m.Msg == WM_NCHITTEST && !this.DesignMode)
			{
				m.Result = (IntPtr)HTTRANSPARENT;
			}
			else
			{
				base.WndProc(ref m);
			}
		}

Open in new window

However, I also need the underlying control to be able to see mouse move events as well. Right now that's not working. Can anyone tell me what I need to do in addition to the above to pass mouse move events through to the form?
0
Hello,
I am working on a VS2008 project which uses crystal reports.
All the crystal reports appear with VS2017 icon and when i click on it , it would not open. Instead it gives the message
"Please wait while windows configures Crystal Reports Basic for VS 2008."
What should be done to fix this issue?
crystal report  .rpt file


Thanks in Advance
0
In the program I am writing I need to compare file I have found, with the version stored in TFS source-control.

How can I diff the file programmatically?

I have found the "Microsoft.TeamFoundation.Client" namespace. Is this where to start?

Ideally I would like to achieve the same result as the "compare" in Source-control.
0
Learn SQL Server Core 2016
LVL 13
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Hello all!  I am hoping this issue is an obvious one to someone 😊  I have a Windows Forms application that does some independent processes on separate sub-forms.  It has a MainForm that opens first and then it opens the sub-forms based on an “is active” database value for each sub-form.  This process runs as expected often for many hours without any issues… opening and closing when necessary.  The issue that I am having trouble figuring out is one where the application just freezes and has to be manually closed and restarted which of course while it isn’t running stops processing altogether.  

There are always 2 errors in the Windows Application error log.  First is a “.Net Runtime” and the second is a “Application Error”.  There is a third Information entry that appears to be logged when the application is restarted but not 100% certain if it is present before it is restarted.  

The MainForm is opening the different sub-forms in a new thread using different versions of this:

try
{
Thread CS = new Thread(new ThreadStart(CS_Start));
CS.SetApartmentState(ApartmentState.STA);
CS.Start();
}
catch { }

Open in new window


And this is the code it is called in the new thread which is opens one of the sub-forms…

private void CS_Start ()
        {
            try
            {
                using (CS_Searches CS_SearchForm = new CS_Searches())
                {
                    if (!CS_SearchForm.Visible)
                        CS_SearchForm.ShowDialog();
                }
            }
            catch { }
        }

Open in new window

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
Hi, I'm getting following error message  when i'm running the stored procedure.But sometime it's working fine.
The transaction has aborted.
Transaction Timeout
0
Hi,

I'm using Visual Studio 2017 and Azure SQL Server 2016.  I'm creating an SSIS package and a script in c#.net

QUESTION:
1. My ReadOnlyVariables = System::StartTime
2. In my script Task, how do I get the value of System::StartTime?
3. how do I format datetime to yyyymmdd_hhmm
4. I want to write this information to a LOG file.  If the app1.LOG NOT exist, then create a log file (E.G., DATESTAMP + ' package kickoff'), else append data to it (E.G., datestamp + 'package completed'.
5. My WriteVariables = User:varFolderName.    in my script task, how do I assign a value to to varFolderName ?

What is the code to do this?  Thanks.
0
I have developed an API, which transfers files from Client to Server; but one major issue is that in-case Client system switched off/internet down the Client not getting any response of that request though the file has been successfully transferred.

Please help out and provide a solution/approach on how to handle and able to retrieve the status of the same request once the Client system/Internet up.
0
Database:  SQL
Environment: Visual Studio and C#

Hello Experts,
I am trying to read a table and write the data in 3 tables.  What is the best read/write and loop I should use.

Thank you in advance!
0
Recently I have been getting .NET library errors while using Macro-enabled Excel documents. When I load the file, there is an error message that says, "Library not found." Macros are disabled, and VBA code is not viewable. I have tried uninstalling and reinstalling Office 365, doing a Quick Repair on the installation, doing a full repair on the installation, updating .NET from the Windows Updates panel, running all Windows Updates available to me, confirmed Firewall and Windows Defender (or whatever they call it now) is up to date. No change in error. I have downloaded a copy of the Excel file to my Mac and am running it with no issues using Excel for Mac 2016. Any suggestion to solve this problem would be greatly appreciated.

Thank you.

Robert
0
I am using Windows Forms and a RichTextBox in c# (Studio 2017) to create a basic editor and now want to add a table. I can do this though the method is very cumbersom, however cannot find an rtf specification, all links I follow are broken. So, two questions:

1. Can anyone point me to an rtf specification?
2. Is there a better way (ie xml?) to do this sort of thing now.
0
How to create a datatable with the time format string incremeted with nearest 15 minutes.
I am using vb.net

example:

Dim dt as new datatable

If the string value is 2:32 then the datatable should have rows in time incrementing by around 15 minutes :

Having rows like :

2:45
3:00
3:15

example2:
String value is 4:34 then the datatable should have rows in time incrementing by around 15 minutes :

Having rows like :

4:45
5:00
5:15

Please let me know if you have any further queries.

Regards
2
CompTIA Cloud+
LVL 13
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I need to implement Google reCaptcha on an old ASP.NET VB Webforms platform and I need a complete code that would help me do that.

I haven't done VB before and have done some webforms development long time ago.

I have followed the instructions of the following link but can't seem to get it right.  I have added the Assembly Recaptcha.dll on the frontend code with the associated VB code inside a <script runat=server> tag just like the guide and after recompiling and replacing the compiled code on the site, it doesn't seem to be able to load the Assembly and pops out the following error message,

Server Error in '/' Application.
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 file or assembly 'Recaptcha, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Source Error: 

Line 1:  <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="register.aspx.vb" Inherits="Website.Members.clsRegister_Page" %>
Line 2:  
Line 3:  <%@ Register TagPrefix="uc1" TagName="ucMessageBox" Src="../controls/ucMessageBox.ascx" %>

Open in new window


All in all if you could help with with the exact implementation code, I would really appreciated it.
0
CU 13 failed to install on a patched to current- level W2016 Data Center host server. Exchange running in Guest W2016DC server---patched current. Their is one DC (host) and 3 VMS (one of which is the E2016 server).

Had previous Cu12 server running and ran CU13 to upgrade after installing .NET 4.7.2. Could not uninstall via P&F. Ended up using  ASDIEdit to hack Exchange server and Exchange autodiscovery out of DC registry. Also removed system mailboxes and all Exchange security groups. Deleted C:\Program Files/Microsoft/Exchange\etc... Removed all Exchange registry entries for MSEXch services. Trying reinstall I get:

Global Update needs to be made to AD and this user account is not a member of Enterprise Admins group (it is)

You must be a member of the Organization Management group or member of Enterprise Admins group (it is)

You must use an account that's a member of the Org Management group to install the first MB server (it is)

You must use an account that's a member of the Org Management role group to install the first CAS server role... (it is)

It then continues the same folderol in the topology group... (it is for all error messages)

Couldn't find the Enterprise Organization container

Forest functional level has to be server 2003 or later Forest and Domain are 2016

Either AD doesn't exist or could not be contacted...

User running setup is the 800# gorilla and has every role needed assigned.

Warning: Setup will use Setup /PrepareAD No …
0
Hello,
  We have a PCL-1712 PCI Data aquicision device (DAQ). I want to get the data from analog input and pass the to analog output in almost realtime. The DaqNavi SDK contains and DAQ Emulator which you can use for programming/test. Since the SDK is buggy with Delphi it needs to be done in MFC/C++.

Anyone can program it ?

SDK Link: https://support.advantech.com/support/DownloadSRDetail_New.aspx?SR_ID=1-13L33UP&Doc_Source=Download

Thank you
0
In radSpreadSheet how can I set a cell value by its name? meaning excel cell "B1" for example
0
Hello Experts,
I am trying to debug a Stored Procedure from Visual Studio 2013.  I have already done the followings.  When tried to Execute the code, the break points works in C# code.  But in the SP the Break Point displays the message "the breakpoint will not currently be hit...", and never goes there.  Please let me know if I am missing anything.

Under View --> Server Explorer --> Added the Database.  Picked the Stored Procedure and added the Break Points.  Also added the Break Point in the C# code in VS.

Thank you very much in advance.
0
Run dotnet ef database update to add tables for my application. However, one of the table "Item" doesn't create. Any idea ?

Without wrong when running the command.

Thx

SQL DatabaseTimepieceContext.cs20190820084617_InitialCreate.cs20190820084617_InitialCreate.Designer.cs
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.