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

I am developing an electronic medical record (EMR) system.

I am designing and implementing the backend APIs using WCF.

Now, I have two system actors: secretary and doctor.

I designed the services according to the actor he/she is concerned.

[ServiceContract]
public interface ISecretaryService
{
}

[ServiceContract]
public interface IDoctorService : ISecretaryService
{
//the doctor has the functions of secretary in case she was absent!
}

Open in new window


The problem is I have duplicate code which is the implementation of the ISecretary contract in doctor service.
0
ASP.NET + JavaScript + Client Side CustomValidators - I Have Question  

I have a ASP.Net standard Web Form working on validation - www.enflow.com/CC/P1/EE.aspx

Click The Other Button and a text box will appear... do not put any text into that textbox

Now Click Submit Button and you will CORRECTLY get a Validation Summary Msg saying missing text for the Describe Other textbox

But if you put text into that textbox and click submit button again then you will keep getting the same validation error...

I think i am missing something simple in JScript ClientSide Validation Call or ??


Here is JScript for Client JS Call...
      function valOther(sender, args) {
          if (document.getElementById("<%=Other.ClientID %>").checked == true) {
              if (document.getElementById("<%=MoreOther.ClientID %>").value === null) {
                  args.IsValid = true;
              } else {
                  args.IsValid = false;
              }
          }
      }

Open in new window

Here is All the Code In this Webform
<%@ Page Language="VB" AutoEventWireup="false" Debug="true" MaintainScrollPositionOnPostback="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.UI.Page" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.data.OleDb" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<%@ Register Assembly="System.Web, Version=2.0.0.0, Culture=neutral, 

Open in new window

0
I am capturing a string of data that has some no printable characters from a COM bus. I capture them with a string variable and then display them inside my listbox window.

I put breakpoints on the string variable after a capture the complete data from the COM bus and I see the non-printables in the watch window. However I don't see the non printable inside the listbox control.

Any ideas would be appreciated

Thanks in advance.
0
I have a webform that has dropdowns and textboxes. I created a stored procedure and code behind to insert the data, now i'm trying to consolidate an update were the user would only need to use one button. Once the button is inserted or saved the button is clicked it would only show update. It would only show update or do an update if the Primary Key is created so there would have to be a select statement as well. I could even accept a way where there are two buttons. After empty webform is loaded the insert button is enabled but update disabled and once insert button is clicked it is disabled indefinitely and update is enabled indefinitely since there is already a newly created primary key.  

here are the insert and updates in the code behind:

Insert code:
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim strConnString As String = ConfigurationManager.ConnectionStrings("MerchData").ConnectionString
        Dim con As New SqlConnection(strConnString)
        Dim cmd As New SqlCommand()

        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "[dbo].[InsertPurchaseOrder]"
        cmd.Parameters.Add("@Suppint", SqlDbType.VarChar).Value = ddlSupplier.Text.Trim()
        cmd.Parameters.Add("@VendorCode", SqlDbType.VarChar).Value = tbsuppliercode.Text.Trim()
        cmd.Parameters.Add("@classgroupAllocID", SqlDbType.VarChar).Value = If(ddlclass.Text = String.Empty, DBNull.Value, CType(ddlclass.Text, String))

Open in new window

0
Hi,

I'm using below code for running some procedures and also i would like to show them their status in my data grid view as below.

But i'd like to know that is there any way to simplify these code or you think it's the best approach i can?

Especially i mean this type of blocks(i take one of them as an example from bigger code block)

          If nodeForceOut.Checked = True Then
                Dim rowIndex As Integer = FindRowDgv(nodeForceOut.Text)
                Try
                    StyleStatus(rowIndex, "Performing", Color.Yellow)
                    ForceOut.MeasureForceMarker()
                    ForceOut.ListForceOutputs()
                    StyleStatus(rowIndex, "Finished", Color.Green)
                Catch ex As Exception
                    StyleStatus(rowIndex, "Error Occured", Color.Red)
                    Tools.OutputLog.Print(Tools.OutputLog.Type.ERR, ex.Message)
                End Try
            End If

Open in new window


Any help would be grateful. Thank you.

        Public Shared Sub Run(ByVal mdl As IScrModel)
            If mdl Is Nothing Then
                Throw New ArgumentNullException(NameOf(mdl))
            End If

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

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

Open in new window

0
Create Session id after my save button click.
I'm trying to simply create a session id after my save button event. After i save my data, i'd like to have my session be the primary key of Table2 which is titled POMONTHID, so it's not visible in any of the code behind or stored procedure.

My original SQL Stored Procedure to insert my data is
ALTER PROCEDURE [dbo].[ReturnIDwithOutput]
	@Suppint Varchar(50),
	@VendorCode Varchar(10),
	@classgroupAllocID Varchar(10),
	@Season Varchar(4),
	@quarter Varchar(50),
	@Month Varchar(50),
	@DateAllocated Date,
	@StyleCreated Varchar(5),
	@EDIT BIT,
	@Category VARCHAR(50),
	@POID INT OUTPUT
	
AS
BEGIN
	SET NOCOUNT ON;
	--DECLARE @POID INT;
	INSERT INTO [dbo].[Table1] (Suppint,VendorCode,classgroupAllocID,Season,[quarter],CreateDate)
	VALUES (@Suppint,@VendorCode,@classgroupAllocID,@Season,@quarter,GETDATE());
	SET @POID = SCOPE_IDENTITY();
	
	INSERT INTO [dbo].[Table2](POID,[Month],DateAllocated,StyleCreated,EDIT,Category,CreateDate) VALUES (@POID,@Month,@DateAllocated,@StyleCreated,@EDIT,@Category,GetDATE());

END

Open in new window


the code behind to call the stored procedure from ASP objects is here:
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click

        Dim strConnString As String = ConfigurationManager.ConnectionStrings("connstring").ConnectionString
            Dim con As New SqlConnection(strConnString)
            Dim cmd As New SqlCommand()

            cmd.CommandType =

Open in new window

0
Hi,

I have a Microsoft Access database for projects and i added a Lookup&Relationship oclumn to my access database and i typed the values i wanted like an example below.
000495.jpg000496.jpg
But when i binding this datasource in my tool and insert combobox and set DisplayMember this column. I couldnt be able to see items in my combobox items collection.

I thought i'm making mistakes in this topic, any experts can help me where i am wrong ?

thanks.
0
Hi,

I'm using COM-interface enginnering software in my tool and getting some output channels from the program, and i'm listing them in datagridview in my tool.(Like Force, Torque, Displacement, Stifness etc. information ). Datagridview's column header text information comes from tool.

I'm trying to add their units to Column's Tag property, because in next steps i'd like to compare Newton, velocity, torque values in some tolerances,


So how is it possible to tag columns according to their header text keywords.

For example if column name contains Force, Newton, Output Force this column's tag will be "N", or Torque, Moment this column's tag will be "Nm", or Velocity, Speed etc. this column's tag will be "m/s".

How is it possible to do that? Any help would be grateful.

Thank you.
0
Hi Experts,

I'm using Visual Studio 2013 (yes, am roaming with the dinosaurs!) for VB development.

I would like to know the line count for each function and sub, broken down by module.
It would also be nice to be able to sort the results by line count.

Is there a free or inexpensive tool that will do this?

Regards,
Leigh
0
Hello,
I created login form and I was able to create rights for admin and user but it only makes the button that I want to disappear, but when I exit from the form and get back to it I see the button on the form, meaning when i click the login button it hides the buttons on the other form. how can I make those buttons hidden all the time when i login with user.
The code is attached
Thank you
0
Hi

In my ASP.net web app I pull data through to a GridView. One of the columns is  Date column.I have now been asked
to show the data with the dates along the top horizontally as opposed to vertically in a column. How would I go about this?
The image shows the dates at the top.

1Image1.png
0
Hi

In my ASP.net VB.net web app I am trying to view an image in one of my folders using the following two lines but the image is not appearing

     Dim FilePath As String = Server.MapPath("~/Uploads/" & oSelectedFile)
     Image1.ImageUrl = FilePath

Open in new window

0
I'm working on a vb.net program, and on my main form, I want a sub to run when another form in the program closes. The main form is called CurrentAmountsForm and one of the other forms is called InitialEntryForm.  I tried this sub, but it's not working.
    Public Sub InitialEntryForm_Closing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
        LoadAmounts()
    End Sub

Open in new window


How can I execute my "LoadAmounts sub when another form closes?
0
Hi

I am having a problem that Excel is still running as a process.

  Private Sub LOADEXCEL()




        If IO.File.Exists(Fullpath) Then
            Dim Proceed As Boolean = False
            Dim xlApp As Excel.Application = Nothing
            Dim xlWorkBooks As Excel.Workbooks = Nothing
            Dim xlWorkBook As Excel.Workbook = Nothing
            Dim xlWorkSheet As Excel.Worksheet = Nothing
            Dim xlWorkSheets As Excel.Sheets = Nothing
            Dim xlCells As Excel.Range = Nothing
            Dim supplierworksheetexists As Boolean = False




            xlApp = New Excel.Application
            xlApp.DisplayAlerts = False
            xlWorkBooks = xlApp.Workbooks
            xlWorkBook = xlWorkBooks.Open(Fullpath)


            xlWorkSheets = xlWorkBook.Sheets




            For Each xlWorkSheet In xlWorkBook.Sheets

                Dim sheetname As String = xlWorkSheet.Name


                loaddatatable(xlWorkSheet.Name)


                'Only interested in first sheet
                Exit For
            Next


            NAR(xlWorkSheets)

            NAR(xlWorkSheet)
            xlWorkBook.Close(False)
            NAR(xlWorkBook)
            NAR(xlWorkBooks)
            xlApp.Quit()
            NAR(xlApp)









        Else
            MessageBox.Show("'" & "" & "' not located. Try one of the write examples first.")
        End If


    End Sub

Open in new window





 Private Sub loaddatatable(ByVal WorksheetName As String)

      

Open in new window

0
Hi

In ASP.net what code would I use to check if a certain file is a pdf. I want to add this check to the following code

    Protected Sub btnView_Click(sender As Object, e As EventArgs) Handles btnView.Click
        Try
            Dim oSelectedFile As String
            If Me.ListBox1.SelectedItem.Text <> "" Then
                oSelectedFile = Me.ListBox1.SelectedItem.Text
            Else
                Exit Sub
            End If
            'Response.Clear()
            'Dim filePath As String = "~/Uploads/" & oSelectedFile
            'Response.ContentType = "application/pdf"
            'Response.WriteFile(filePath)
            'Response.TransmitFile(filePath)

            'Dim FilePath As String = Server.MapPath("piyushsir.pdf")
            Dim FilePath As String = Server.MapPath("~/Uploads/" & oSelectedFile)
            Dim User As New System.Net.WebClient()
            Dim FileBuffer As [Byte]() = User.DownloadData(FilePath)
            If FileBuffer IsNot Nothing Then
                Response.ContentType = "application/pdf"
                Response.AddHeader("content-length", FileBuffer.Length.ToString())
                Response.BinaryWrite(FileBuffer)
            End If

        Catch ex As Exception
            'Response.Write(ex.Message)
            Me.lblErrorDeleting.Text = ex.Message & " hr556"
        End Try
    End Sub

Open in new window

0
How can I authenticate the User ID and Password to be valid from VB.Net and VB6 programs with Windows 7 Active Directory?
0
Hello I'm troubling with my application's font size. I don't know how to handle for different screen resoulitons and most of them i set with the Visual Studio designer.

I'm trying to set font Segoe UI and with 10pt but in different controls the size seems different even the designer properties are same.

Now i'd like to clarify, what's the experts in ux approach

set the font in designer or runtime?
using point or pixels ?
How do you handle Microsoft Font Size(Display Settings) and screen resouliton.
Any help would be greateful.

Thanks.
0
Hi,

As you can see below picture my font sizes seems different on controls. But i set all of them Segoe UI 9.75 pt. Why this is happening and how can i solve that?

Any help would be grateful.
Thanks.
Hakan000494.jpg
0
Hello,

I have a third part COM interface to get some information. In here there's special classes for that objects which i bring from COM interface.

These classes have some properties and these properties are also in type of different classes. I'd like to list two object differences but don't know how to do that programmatically because this is only one class type there's also more than 30 classes with different type of property classes.

Is there anyway to do that? I'd like to recursively check properties and if its output class has properties i'd like to get them also.

Any help really really helpful, i'm needing guidance of experts.

Regards.

Picture1.png
0
Hello,

I'm searching for project management and gantt chart tools. Does anyone know any library for this purpose.

Thank you.
0
Hi,

I'm creating some datagridviews on my tool but i dont know how to crate them an event?

For example i'd like to create DataGridViewCell click event.

Any help would be grateful.

Regards,
Hakan
0
Hello,

I'm trying to find all datagridviews under listed in my TabControl "tcMain" but the datagridview levels are different some of them containing in tabpage some of them containing under panel.

How is it possible to get all of them.

Any help wouıld be grateful.

Thanks.
0
I'd like to remove all tab pages in specific tab control and it's child controls. I only want "GUI.tabCheckDashboard" tabpage should stay and i'd like to remove all tabpages and it's child controls. I'm using below code;
        Private Shared Sub CheckDefaults()
            Dim tc As TabControl = GUI.tabCheckLocal
            For Each page As TabPage In tc.TabPages
                If page IsNot GUI.tabCheckDashboard Then
                    tc.TabPages.Remove(page)
                End If
            Next
        End Sub

Open in new window

0
How do I right justify a label?  My labels are all fixed size and set to False on AutoSize in Visual Studio.  I tried few things, like lblCode1.Text = lblCode1.RightToLeft, but nothing seems to work. Isn't there a simple way to right justify labels? Here's an example of what I'm doing.
lblCode1.Text = IO.File.ReadLines(AppDomain.CurrentDomain.BaseDirectory + "_data/file1.txt").Last()
lblCode2.Text = IO.File.ReadLines(AppDomain.CurrentDomain.BaseDirectory + "_data/file1.txt").Last()
lblCode3.Text = IO.File.ReadLines(AppDomain.CurrentDomain.BaseDirectory + "_data/file1.txt").Last()

Open in new window

And I've tried to do the following before the above code, and I also tried it after the above code, but neither work.
lblCode1.Text = lblCode1.RightToLeft
lblCode2.Text = lblCode2.RightToLeft
lblCode3.Text = lblCode3.RightToLeft

Open in new window

I'm assuming there is an easy way to right justify a label?
0
Several years ago a developer in Seattle set up a cloud service for me and enhanced my vb.net program so it could access the service at http://argonsvc1.cloudapp.net/facade/scanner.svc.  This vb.net app runs on older Symbol scanners using Windows CE and Compact Framework compiled using Visual Studio 2008, since we can't use any version more current than 2008.

Fast forward to now, where the developer has set up a new server for our new Android apps, while intending to make it possible for this older app to also access this new server as https://facade.argonservices.com/Scanner.svc.  If I simply change the Web Reference URL in my code to this, it compiles fine, but won't connect with the service.  He thinks it's because I'm having to now use a https connection vs. the old http.  

The developer does not know how to fix this problem--which is why I need help here at e-e.  He did make a few suggestions as follows in the conversation below--most of which I don't understand:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It could be that the legacy code is configured to only connect to non-secure/encrypted channels on that service call.
Odds are you need to alter the service binding to allow for a secure channel.  

He then told me to look for references to "BasicHTTP" and the conversation continued as follows:

There are about five points in the program that include “BasicHttp”, such as the one below.  Does this mean I can manually change those to “BasicHttps” and expect …
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,