Visual Basic.NET

94K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,

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

Sign up to Post

Excel worksheet - Sum of specific columns against specific rows and inserts into adjacent columns.

1. Insert row after last Newspaper title
2. sum column R
3. insert column R total into Column G
4. sum column S
5. insert column S total into Column j
6. insert column A bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
7. insert column H bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
8. insert column K bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
9. insert column M bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
10. insert column O bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
11. insert column Q bottom row content into all rows above so that any amount keyed into the bottom cell will appear in all cells above.
12. repeat for each different newspaper title

Example file attached - Sheet1 with original worksheet. Sheet2 with example.
EENewspapersExample.xlsx
0
I am using Sql Server 2012.

In VB.NET, I have a situation where some of the data I am reading from a text file has double single apostrophes in the last name for a persons name.
The code eventually inserts the name into the database using a stored procedure.

 My approach to fix the double single apostrophe issue is to replace the double single quote with the Ascii value equivalent of Char(39).
This work perfectly. Then a stored procedure is called to insert NameStr into a database table.

 Dim NameStr As String = "O''Donnel"
 Dim Apostrophe As Char = Char(39)
 NameStr = NameStr.Replace("''",NameStr)

 So based on my above approach, does anyone know if this would work for earlier versions of sql server, such as sql server 2000 or sql server 2005?
 I don't have any version earlier than 2012, so I am not able to test for different versions.
0
In VB.net, I'm trying to use the system.components.designerproperties.IsInDesignMode attached property to prevent code from running in design mode but designerproperties isn't showing up in intellisense when I type "system.components.".  I also tried to include "Import system.components" in my code and it still doesn't show up.  How can I access the "IsInDesignMode" property in my code?
0
I'm creating a simple form in asp.net.
On page load, I want to display the user's name (I'll get to that later if I can't figure it out )
Next I want to retrieve a list of elements from a SQL table that belong to this user.
If there are any results returned, I want to get a total and display a label that says "You have X items" and then show a checked listbox with the items.
If there are no results, no list would be displayed and a message stating that they have no items.

I can handle the  logic for displaying everything, but it's been so terribly long since I've done any development in asp.net, that I don't really know where to begin to make that SQL connection and pull back results.
I would need to pass credentials because the user's account won't have permissions to read the data.
But the table layout will have a field called Owner that would be equivalent to their user ID that I'm returning from the windows login identity.

If someone could help me get started, I think I can carry this on to completion, as presumably it will come back to me... (I hope)
0
Hello Experts,
We would like our app to be commanded by voice.
let's say, be able to recognize a set of 20 commands and then just type what is pronounced.

Is there any library or app that may let us do this with our already existing app?
We can develop too... so please your guidance.
Regards,
0
I need a resume in cristal reports 2008 that give me a result if all the columns are the same

Im attaching an image of what i need to do

if all "ir altas" then in the resume put me "ir altas" if not all "ir altas" in the reume remain blank or another textt
results.jpg
0
We need to write a vb.net application that sends the attached xml to an API. The idea is that the product stock level is set. The top part of the file is the request and the bottom is the response. This is the soap example given to us by the ecommerce platform. The app is not a web app but a desktop based piece of software and we just need to now how to send this using SOAP in vb.net. Any help along with examples would be greatly appreciated.
0
I've TreeView with checkbox nodes, each node's childnode is representing a sub procedure feature that will perform if this option checked.

000479.jpg
I put them in one single button, but i had to check all of them individually but this is a bit hard way to define each of them because it's hard to handle.

Is there anyway like to create a dictionary with this child nodes and sub procedures.

 Public Shared Sub RunCheck(ByVal mdl As IScrModel)

            Dim tView As TreeView = GUI.treCheckListMain
            Dim dgView As DataGridView = GUI.dgvCheckInfo
            dgView.Rows.Clear()

            For Each nodeParent As TreeNode In tView.Nodes
                For Each nodeChild As TreeNode In nodeParent.Nodes
                    If nodeChild.Checked = True Then
                        dgView.Rows.Add(nodeParent.Text, nodeChild.Text, "In queue")
                    End If
                Next
            Next

            If tView.Nodes.Item("nodBody").Nodes.Item("nodBodyComp").Checked = True Then
                Dim rowIndex As Integer = FindRowDgv(tView.Nodes.Item("nodBody").Text, tView.Nodes.Item("nodBody").Nodes.Item("nodBodyComp").Text)
                Try
                    StyleStatus(rowIndex, "Performing", Color.Yellow)
                    Body.ListBodies(mdl, GUI.GetRecursive(GUI.cboCheckBodyComputed_recur.SelectedIndex), GUI.dgvCheckBodyComputed)
                    StyleStatus(rowIndex, "Finished", Color.Green)
                Catch ex

Open in new window

0
I have a vb.net program that was done several years ago and has references to .NET 2.0. How can I change this to .NET 4?
.NET 2.0
0
I want to display the value of a field in SQL Server database table in a textbox on a form only if the value changes. Periodically reading the table and updating the textbox if the value has changes is not an solution because i have hundreds of textboxes on the form and only some may change every second.

The SQL query may be of the form "SELECT TOP 1 Value FROM tblQA WHERE Key='ExampleKey001'".
0
Hello,

I have been tasked with working on a legacy application.  This application is written in VB.NET WinForms, and there is quite a lot of code in the project already to handle things like database connectivity, error handling, reporting, logging, user notifications, etc.

The last developer to work on the app added a second project to the solution for a custom WPF control he created.  It's still titled "WpfControLibrary1", and the control is "UserControl1" so i'm guessing he didn't spend much time on it.  The control itself uses MVVM C# and it's been added into a winform in the original project with no code behind it.

My question is this: How can I access this pre-existing classes, modules, and forms in the original project from the new control?

For example, if I want to export data to Excel in the old project I would simply instantiate the "DataExport" class and pass the dataset to its "ToExcel" method.   Similarly, how could I access a property/method from the main form?

I'm really not very familiar with WPF, and could use a nudge in the right direction.  Perhaps i'm not searching for the right terms, or maybe it's just not possible.  However, I'm really not looking to re-invent the wheel here, just need to figure out how to leverage/access the pre-existing code for what would normally be 5 minutes worth of work if it weren't for the WPF.

Thanks in advance for your time.
0
Hi

I want to learn how to use REST to interact with wep application API in VB.net.
Where do I start?

Thanks
0
In my application Splash Screen loads at the same time with my startup form. I don't know what is causing that my splash screen vb code like below. And also i took and screenshot from application settings.

Option Explicit On
Option Strict On

Public NotInheritable Class SplashScreen1

    'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
    '  of the Project Designer ("Properties" under the "Project" menu).


    Private Sub frmSplashScreen_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Set up the dialog text at runtime according to the application's assembly information.  

        'TODO: Customize the application's assembly information in the "Application" pane of the project 
        '  properties dialog (under the "Project" menu).

        'Application title
        If My.Application.Info.Title <> "" Then
            ApplicationTitle.Text = My.Application.Info.Title
        Else
            'If the application title is missing, use the application name, without the extension
            ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If

        'Format the version information using the text set into the Version control at design time as the
        '  formatting string.  This allows for effective localization if desired.
        '  Build and revision information could be included by using the following 

Open in new window

0
I'd like to create a dashed border with some radius on corners like picture below. I'd like to use this panel with DragDrop feature.

indir.png
0
I'm using a 3rd part software's COM interface named Interop.simpackcomslvLib and this is related to program SIMPACK version 2018 and this COM is cannot isolate probably it's using some DLL's about this program.

Now i wonder is it possible when this program's newer version released like 2019 or 2020 how can i implement(remove old reference and adding new one) to my compiled application?

2019-04-25-23_20_33-Window.png
0
I've text file like below and i'd like to read them by row number and assign their values automatically to Windos Form textbox control.

How is it possible to read specific rows (in my file desired values' row index is 2,5,8,11...) and assign their value to my application's textbox.

######## Log File for RBE2 elements (Be careful to have write permission to folder, file names are not important)
C:\Users\USER1\Desktop\Sample_BIF\condensRun_13042019\test4.log

######## Log File copy for RBE2 elements(Be careful to have write permission to folder, file names are not important)
C:\Users\USER1\Desktop\Sample_BIF\condensRun_13042019\test4_copy.log

######## Excel file to get set id to delete
C:\Users\USER1\Desktop\Sample_BIF\condensRun_13042019\input_condensationPrep.xlsx

######## Excel file sheet number
1

######## Column for Delete?
3

######## Column for Set ID
4

######## First Row of SetIDs (Source)
2

######## Last row of SetIDs (Source)
12

######## Sleep Time
10000

######## Column for Leaf Spring Property ID
6

######## Column for Reference Nodes
7

######## Column for Interface Nodes
8

######## BUSHING STARTS - Changed node number start. This number will be the start point while renumbering
12001

######## Bush properties K1
150000

######## Bush properties K2
200000

######## Bush properties K3
300000

######## Bush properties K4
400000

######## Bush properties K5
500000

######## Bush properties K6
600000

######## Bush property ID
120

######## Bush 

Open in new window

0
I'd like to know my users when they are open my application. I'm trying to manage Users and Roles and don't know how to do so i created a Access Database for users like below.

User Informations
and also i'm defining access options as UserRoles  according to user like below.

User Roles
When user opens the application, i get UserName, UserDomain and UserMachineName information and compare it with my Access db information if user doesn't exists application exit. If user in database it looks it's UserRole options. If user access checked, related panel is enabled if it's not checked it returns false and make panel invisible.

I'm calling below code on  form's "Load" event with EVENT__USER.DefineUser().

It's working but the main problem is it's  not efficient because it tooks a bit to open tool, it's about 30 seconds to load application only because of this. Could anyone suggest me logic way? I need Role Based User Rights but probably this isn't way to connect and check or am i doing something wrong?


Option Explicit On
Option Strict On
Imports System.IO
Public Class EVENT__USER
    Public Shared Sub DefineUser()

        Dim dbDir As String = Path.Combine(Environment.CurrentDirectory, My.Settings.str_accessdb__data_dir, My.Settings.str_accessdb__data_db)
        Dim dtUsers As DataTable
        Dim dtRoles As DataTable

        dtUsers = AccessUtility.ReadTable(dbDir, "Select * from Users")
        Dim UserName As String = 

Open in new window

0
Hi All,

Well it looks like some of the simplest things are causing me the most trouble.

I am trying to download an image, VB.NET,  that has some 'Embedded' code/script in the URL.

Example:
https://img.discogs.com/Zs_NkppmE3Jh1t9qpaETecKVLJU=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-5514089-1395334223-8017.jpeg.jpg

This URL will produce an Image when run in a browser, but will return a 503 Server Unavailable error when run from within my code. I have tried 3 different approaches and each one produced the same 503 error...  The following are the three things that I have tried. Any help is (again)  greatly appreciated..

...
My.Computer.Network.DownloadFile(ThisImage, LocalImageFileName)
...

Open in new window


...
myWebClient.DownloadFile(ThisImage, LocalImageFileName)
...

Open in new window


Public Function MyDownloadImage(url As String, saveFilename As String)

        Dim httpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
        Dim httpWebResponse = DirectCast(httpWebRequest.GetResponse(), HttpWebResponse)
        If (httpWebResponse.StatusCode <> HttpStatusCode.OK AndAlso httpWebResponse.StatusCode <> HttpStatusCode.Moved AndAlso httpWebResponse.StatusCode <> HttpStatusCode.Redirect) OrElse Not httpWebResponse.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase) Then
            Return 0
        End If
        Using stream = httpWebResponse.GetResponseStream()
            Using 

Open in new window

0
Hi

In my VB.net windows form I have the following TreeView that show Tables and columns.
What VB.net code would I use to gather a list of tables that are checked and then a list of columns
that are checked for that table?

Thanks

1
0
Ok I have a Simple ( maybe not so simple ) SHELL escape that fails when executing from within my code but runs fine when executed from a Command Prompt. Here is the command that I am trying to execute:

 Shell("curl ""https://api.discogs.com/database/search?q=" + SearchString + """ -H " + """Authorization: Discogs token=" + MyToken + """ > C:\Downloads\CurlOutput.txt 2>&1")

Open in new window


I get a system error telling that the file NOT FOUND... I am redirecting the output TO a file NOT reading FROM a file???

Here is the expanded version of that string.. I can change my TOKEN at any time so it is ok...

curl "https://api.discogs.com/database/search?q=0075992511025" -H "Authorization: Discogs token=xyz" > C:\Downloads\CurlOutput.txt 2>&1

Open in new window


I am using VS 2017 and I am coding in VB.NET on a Windows 10 Machine

Thanks in advance
Rick
0
Hi

In my VB.net windows forms project I want to write text files with names that the user won't now.
So I want to use a function to convert a string to a confusing name and then another function
to convert the function back to the original string
I am hoping someone has done this before and can give me some example VB.net code.

Thanks
0
Hi

In VB.net is it possible to create a folder in windows explorer that is password protected?

Thanks
0
Hi

I have an Excel VB.net Add-in project that interacts with an Azure SQL database using a connection string.
I want to control which tables a user can see and edit.
What is the best way to do this. Should it be set up inside the Azure  SQL database per user name
and then a different connection string given to various people?

Thanks
0
I'm using TreeView as my navigation. When i'm selecting the node i'd like to load UserControl on next panel near navigation. I'm starting an example work but i realize it's not logic way for coding. I have about 15-20 nodes and it means i will copy same logic code for 15-20 times. I didn't find a solution to make it easier if there will be a dictionary for (node,usercontrol) it'd be easy but i can't create such a dictionary.

My example code is like below.
    Private Sub treToolNavigation_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles treToolNavigation.AfterSelect
        Dim node As TreeNode = treToolNavigation.SelectedNode
        Select Case node.Text
            Case "node1"
                Dim f As New UserControl1
                SplitContainer2.Panel2.Controls.Add(f)
                f.Dock = DockStyle.Fill
                f.Show()
            Case "node2"
                Dim f As New UserControl2
                SplitContainer2.Panel2.Controls.Add(f)
                f.Dock = DockStyle.Fill
                f.Show()
            Case "node3"
                Dim f As New UserControl2
                SplitContainer2.Panel2.Controls.Add(f)
                f.Dock = DockStyle.Fill
                f.Show()
        End Select
    End Sub

Open in new window

0
I'm using listview as WinForm control in my application. I'm using a single column list type but the problem is FullRowSelect property doesn't work with my application.

listView1.FullRowSelect = true

Open in new window


Does anyone has experience how can i use FullRowSelect feature?
0

Visual Basic.NET

94K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,