.NET Programming





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 Experts,

We have a folder 1 in a network drive.And folder 2 containing 15 different folders say f1 to f15.
Some third party sources put in files which may be upto 150 in number in a day into folder 1.
Each file is named such a way that it had destination folder name within uts name like f1p1data.csv, f3p2data.csv, f1p2data.csv etc.
Here f denotes which folder the file is to put and p denotes priority to be picked up..as in p1 to be picked up first and so on.There is this vbs ript code that runs this logic of putting files one by one into subfolders.The vbscript is present in my local.When ever a file gets picked up into subfolder say f1 for ex..an already existing file say available.txt in f1 folder changes into assigned.txt.A separate process which is scheduled, processes the file in f1(basically moves the file into my local drive and processes) and at last renames the assigned.txt to available.txt.And the process continues.Problem 1: since its  drive, moving file into subfolders is slow
Problem2: since files keep arriving in folder 1, the vbscript seems to be becoming slow in finding the priority file
Please suggest a better way of doing this and combatting the latency.Also suggest a alternate way of looping through as ..files are still getting copied into folder 1 when the vbscript is looping through to find top priority file from one iteration through all files present jn a given time.
Free Tool: Site Down Detector
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I have a screen that a user can either enter information(about 5-6 fields) and click Add Item or they can enter in an ID(one of the fields) and click Search and it will populate all the other fields. This works great. I had RequiredFieldValidators for the fields that are mandatory(all of them) and I noticed that when I tried to do a search that the fields would have the validation messages next to them and it would never hit the code behind for the search button. Obviously the validator is working on the client side and doing its job but it wouldnt let the server side code to run? I want to have the functionality of the search button to fill the fields with data and for the RequiredFieldValidators to work when the Add Item is clicked.
 Now, I read where you can set EnableClientScript="true" in the validators(client side) and that allows the server side code to run when I click Add Item but then the validators are allowing missing fields. I tried to set the EnableClientScripts back to false but when I test and click Add Item, with no data, its saving a blank record and thats not cool!!!
Any thoughts on this? Any help would be appreciated!!!

Hi EE,

in vb.net, I have a TreeView control.

each nodes (lets say I have 5) like this :


each of them has an "ID" or a "Code" in the background.  lets say its :

Apples     [0020]
Tomatoes   [0025]
Oranges     [0060]
Grapes     [0061]
Bananas    [0110]

My 2 questions are :

1) If I have a button "Add item" is it possible to add a node at the end of the tree, the user writes the name of the fruit, then he could drag the new node somewhere in between 2 fruits to place it where he wants it ?

2) since there are codes to each fruit, if user drags it in between [0025] and [0060] I would like the code to be automatically created at 0026 to be placed in between !

But it goes to another question, what If after the user creates another one and wants to place it in between of 0025 and 0026 ? now there is not space anymore between the codes ! we would have to increment of + 1 all the codes then place it in between.

so thats my issues... I realyl need help on this...
thank you.

(I am using fruits as an example but this is for work in our Logistic menu in our system. right now its not efficient, I have created the TreeView and reading values from SQL, but im stuck there for the rest)
I am developing an application that needs to connect to an Oracle database. I've added the required Nuget packages to connect to the database. If I have the DBA credentials to a schema, I can connect fine and expand the tables in the schema to add them to my model. However, on another schema I only have permissions to SELECT from a table. So, when I go through the wizard to set up my EF model I can get to the page to select the Tables I want to add to my model. However, I can't get the Tables node to expand in order to select the table that I have SELECT permissions on. The first screenshot show the screen I am stuck on. I Cannot click the check-box or expand the node to show the tables. The second screenshot shows the same behavior in VS2015 Server Explorer in that the node under 'Tables' can't be expanded to show that table I have select access to.

As I said before, there are other schemas where I have DBA privileges and these work fine (I can expand all the nodes) . Surely we are not restricted to users with DBA privileges when  using EF?

Any help, much appreciated
Oh dear experts
I need to read XML files, any advice ?

I need to put an xml in a readable page in VB,
so its a basicaly a complaint form ,if the complaint is solved it should remove the row automatically from datagridview
I am using the FileUpload control in ASP.NET and I am trying to convert any file uploaded to a TIF into SQL Server. I am currently saving images as memory stream and into an Image data type in my table with no issues. I was asked to save all files(.doc, .txt, .whatever) as .TIFS and Im not sure its possible, but I would think you could save anything as an image but I have no idea how to do this.
Any help would be appreciated.

I'm having trouble converting a generic list to a datatable using the following code.
When I debug the code, the datatable appears to be loaded properly, columns and rows, but returning from the function it's empty. Can't tell what's going on there.

The page error I'm getting is "Public member 'Project_ID' on type 'DataRowView' not found." which is the first column.

Here's the function call and function, below.

Dim oRecs as List(Of Project) = DirectCast(cCache("Project_Search"), List(Of Project))
Dim dt As DataTable = ConvertToDataTable2(oRecs)

Public Shared Function ConvertToDataTable2(Of Project)(ByVal list As List(Of Project)) As DataTable
        Dim table As New DataTable()
        If Not list.Any Then
            'don't know schema ....
            Return table
        End If
        Dim fields() = list.First.GetType.GetProperties
        For Each field In fields
            table.Columns.Add(field.Name, field.PropertyType)
        For Each item In list
            Dim row As DataRow = table.NewRow()
            For Each field In fields
                Dim p = item.GetType.GetProperty(field.Name)
                row(field.Name) = p.GetValue(item, Nothing)
        Dim iRowCount = table.Rows.Count
        Return table
    End Function

Open in new window

I'm having major issues trying to enable .net 3.5 on Windows Server Essentials, if you look online this is a common issue and i have tried everything i can find but am still unable to install the component successfully.

Installation media is HP ROK which i have copied to the contents to a folder and have tried pointing the add feature wizard to the folder but the install fails.

I have attached a screenshot of the powershell error along with DISM log entry and would really appreciate some help.

Hi all, could me please tell me how to create dll file using vba.net. I need to create dll file and use in word vba. I have create dll file and gave reference via word vba but Activex can't create objects error coming..

Dim tem as testing.test
Set tem = New testing.test

error coming in second line
Congratulations! You’re Certified – Now What?
Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

I have a subdomain subdomain1 in a primary domain maindomain1.com
I created a folder myfolder under the subdomain root, and granted public read/write access on

When I write the following code In my windows application,
            Dim upload As New System.Net.WebClient()
            upload.UploadFile("http://www.subdomain1.maindomain1.com/myfolder" , mylocalfilefullpath)

I am getting error 404 (non existing folder or file. What Am I doing wrong. Thanks for the help
I am using entity framework to fill a nested repeater from a SQL View. It should be selecting the 4 highlighted rows in the view output below:

When I look at the results in debugger it is showing the 1st record, "Body Weight Strength", 4 times. All fields in each row are identical including the time stamp. Of course the repeater is loading the "Body Weight -Strength" row 4 times instead of the four individual rows.

Code from aspx page:
<asp:Repeater ID="rptSummary" runat="server" DataSourceID="sdsSummary">
                        <tr class="Bold">
                                <asp:Label ID="lblWorkoutName" runat="server" Text='<%# Eval ("[Work Out Name]") %>'></asp:Label>
                                <asp:HiddenField ID="hdnWorkOutHistoryId" runat="server" Value='<%# Eval("intWorkOutHistoryID") %>' />
                            <td class="Center" style="width: 250px">
                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval ("dtmDateStarted","{0:ddd, MMM d yyyy}") %>'></asp:Label>
                            <td class="Right" style="width: 135px">

Open in new window

The following code connects only when ODBC is set up with Windows Authentication instead of specific user account. I have set it as User Defined. Is there a difference between User defined and Systen DSN in my case? Here is code the snippet :
OdbcConnection DbConnection = new OdbcConnection("DSN=NRFUsers");
            string UserId;
            string fullname;
            string email;
            string Act;
            string EmpNum;
            string Loc;
            string sDomain;
                OdbcCommand DbCommand = DbConnection.CreateCommand();
                DbCommand.CommandText = query;
                OdbcDataReader DbReader = DbCommand.ExecuteReader();
                while (DbReader.Read())
                    UserId = DbReader["UserId"].ToString();
                    fullname = DbReader["Full_Name"].ToString();
                    email = DbReader["Email"].ToString();
                    Loc = DbReader["Office"].ToString();
                    EmpNum = DbReader["Emp_Num"].ToString();
                    Act = DbReader["Action"].ToString();
                    sDomain = DbReader["Domain"].ToString();
                    WriteLog("User: " + EmpNum + " " + fullname + " " + Act, "NRFUser.log");
Presently I have all my .sln files on the compagny's N-drive. However, the N-drive will be closed down so I want to move the solution files to my C-drive. I have googled this and some states that you can use 'save sln as' but I cannot find this menu. Just moving the .sln files seems not to be a good idea.
Can you tell me how to move my .sln files safely?
I want to copy some data in row or column in crystal report when viewing and pass it data to MS Excel and keep the right format as when view in crystal report like that:

Crystal report data (I selected login Time column data and press Ctrl + C to copy)
and i want to paste that selected data into excel like that:
Is this possible?
Thanks in advance for help.
I got this dumped in my lamp. They need a timer for their Excel vba application. I create a COM class in Visual studio, register for COM Interop, serialization is on AUTO, and XML documentation is checked. Builds fine. I build and import into Excel fine. But when it encounters the new variable it says it can't create the ActiveX component. What they want is the timer to run until it reaches a certain count and then notifys the vba code it is done and displays that value in the spreadsheet - without locking out any other activity going on. Below is the code for the dll in vb.net. I don't get beyond the import reference in Excel and instantiating the object before the ActiveX error. Going nuts here any help appreciated.

 ' A creatable COM class must have a Public Sub New() 
    ' with no parameters, otherwise, the class will not be 
    ' registered in the COM registry and cannot be created 
    ' via CreateObject.
    Public tmrUpdate As New System.Timers.Timer
    Private TimeLeft As String
    Public timeUpDate As Integer

    Public Sub New()
        AddHandler tmrUpdate.Elapsed, AddressOf Tick
    End Sub
    'Public Function TestExport(left As Int32, right As Int32) As Int32
    '    Return left + right
    'End Function
    Private Async Sub DoStuff()

        'Doing stuff

        timeUpDate = 599

Open in new window


Can anyone help me to write a query which will only find exact mismatched row from two tables. Thanks you!

I am passing one class as a parameter in one method. But it is showing like null. I appreciate your help.
I am considering using Devexpress MVC for a simple table-based project.  A colleague says not to do it because it will increase the need for custom UI coding.  Does anyone have experience with whether using Devexpress MVC controls increased or decreases the need for custom UI coding?
Announcing the Most Valuable Experts of 2016
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

I have a single solution C# project in VS 2017.  Within that solution I have 6 projects.

Project A calls Project B during its work.  I want to break the code in Project B, but I have to start in Project A.

I tried importing an "exe" as per the documentation but that didn't work.

Thoughts on how I can debug through multiple projects in one solution?

I Need some help with Visual Studio, I have a project file that was made in VS2008 and I need it to work in a newer version (2012
If you have data rows like

1.  TypeA.     Control 1.  Answer 1
2.  TypeA.      Control1.  Answer2
3.  TypeA.      Control2.  Answer1
3.   TypeB.    
4.   TypeB.     Control1.  

Where you have three different drop downs
Hi Experts,
I need help setting a default value to 0, when the returned value is null, or 0.
I have tried the code below but I get a blank\empty field in my table.  See code below, and let me what I am doing wrong.

var paper = (db.Manifests.Where(m => m.ID == ID && m.ProcessedDate.Value.Month == DateTime.Today.Month).Sum(m => m.Claims != null  ? m.Claims : 0)).Value;
vals.Add((paper.ToString().Length > 0) ? string.Format("{0:###,###}", paper) : "0");

Open in new window

Thank you,
Can anybody help me to convert this code from VB.NET to VBA. It should afterwards be running on a system with: Win10, Excel 2013, VBA

Here is the original Code in VB.NET including the improvment further down in the thread:

Source: https://stackoverflow.com/questions/103725/is-there-a-way-to-programmatically-determine-if-a-font-file-has-a-specific-unico

<DllImport("gdi32.dll")> _
Public Shared Function GetFontUnicodeRanges(ByVal hds As IntPtr, ByVal lpgs As IntPtr) As UInteger
End Function  

<DllImport("gdi32.dll")> _
Public Shared Function SelectObject(ByVal hDc As IntPtr, ByVal hObject As IntPtr) As IntPtr
End Function  

Public Structure FontRange
    Public Low As UInt16
    Public High As UInt16
End Structure  

Public Function GetUnicodeRangesForFont(ByVal font As Font) As List(Of FontRange)
    Dim g As Graphics
    Dim hdc, hFont, old, glyphSet As IntPtr
    Dim size As UInteger
    Dim fontRanges As List(Of FontRange)
    Dim count As Integer

    g = Graphics.FromHwnd(IntPtr.Zero)
    hdc = g.GetHdc()
    hFont = font.ToHfont()
    old = SelectObject(hdc, hFont)
    size = GetFontUnicodeRanges(hdc, IntPtr.Zero)
    glyphSet = Marshal.AllocHGlobal(CInt(size))
    GetFontUnicodeRanges(hdc, glyphSet)
    fontRanges = New List(Of FontRange)
    count = Marshal.ReadInt32(glyphSet, 12)

For i As Integer = 0 To count - 1
    Dim range As FontRange = New FontRange
    range.Low = Unsign(Marshal.ReadInt16(glyphSet, 16 + (i * 4)))
    range.High = range.Low + 

Open in new window

hi experts.
could you pls advise on few online book/video store including subscription option for IT

I was looking at https://www.packtpub.com/ and https://www.oreilly.com/
but they are expensive

how to get subscription with discounted price or coupon code for above sites.

pls help

.NET Programming





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.