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'm able to pass the query parameter successfully to the field however when the item is saved the record is not being saved to the list. What's interesting is that if I manually override the passed value by typing into the field on the form and then clicking save, the record is saved to the list .

We have a working example of this on the same site for a different list that we created about a year ago and does not have this issue.


Original Code Provided when a new form was created for the list in SPD:
<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="AttachmentsID" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@AttachmentsID')}"/>
<SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="AttachmentsID" ControlMode="New"/>


Removed the above code and replaced with the following:                                                            
<asp:TextBox runat="server" id="ff1{$Pos}" Name="FileName" Text="{$AttachmentsID}" Value="{@AttachmentsID}" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@AttachmentsID')}" Width="100px" Height="20px" BorderWidth="0" />
0
I created a form in VB10 containing an animation control generated by the MICROSOFT animation control SP6 Control (MSCOMCT2. OCX), but together with the executable I generate 2 libraries (axinterop. MSCOMCTL2. DLL and INTEROP. MSCOMCTL2. DLL) without which the executable does not work.

There is no way not to generate the executable without the help of these 2 libraries, from what I understand there should be a statement to do in the code.
0
I have a database table that contains the following fields:
1. RecordID
2. Time
3. Action - The Action is either 3 - (StartTime) or 4 - (StopTime).
4. Name
5. Vehicle

Currently I use the following SQL to gather the data:

"SELECT [EventLog].[Date Time], [Events].[Description], [EventLog].[Operator Name],
                                           [Vehicles].[Truck Type] AS 'Vehicle ID'
                                           FROM EventLog INNER JOIN Events ON [EventLog].[Event ID] = [Events].[EventLog Number]
                                           INNER JOIN Vehicles on [Vehicles].[Device Type] = [EventLog].[Serial Number]
                                           WHERE (([Date Time] between '" & DateTime & "' AND '" & DateTime2 & "') AND
                                            ([EventLog].[Event ID] = '3' OR [EventLog].[Event ID] = '4')) ORDER BY
                                            [EventLog].[Operator Name], [EventLog].[Date Time], [Vehicles].[Device Type] ASC;"

But every other record contains either a (StartTime-1st, or StopTime-2nd).
I need the time difference between Start & Stop times, this will give me the running time for each Operator using a particular Vehicle in HH:mm:ss.
Is there any way to incorporate this time difference calculation within the SELECT SQL so I put this data directly into a DataGridView?
This would help by reducing the total number of records in half.

Thank you in advance,
Russ
0
Hello,
Excel Sheet import changes the format of the column.
I am importing a excel sheet in to grid , the format of the date field is set automatically to Datetime.
Please find the code below.
The requirement is that it treats the column as a text column.

Example:
Dates in the column are 18/06 - 23/06 . When I  import the excel sheet , the cell is blank.

 Private Sub PopulateExcelInDatagrid(ByVal Filename As String)
        Dim oledbCon As OleDb.OleDbConnection
        Dim dt As New DataTable
        Try
            Dim csExcel As String = ("Provider=Microsoft.ACE.OLEDB.12.0; Data Source='" & Filename & " '; " & "Extended Properties=Excel 8.0;")
            oledbCon = New OleDbConnection(csExcel)
            oledbCon.Open()
            dt = oledbCon.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
            oledbCon.Close()
            If dt.Rows.Count <= 0 Then Exit Sub
            Dim excelSheets As [String]() = New [String](dt.Rows.Count - 1) {}
            Dim row As DataRow = dt.Rows(0)
            oledbCon.Open()
            Dim oledbAdapter As New OleDbDataAdapter("select * from [" + row("TABLE_NAME").ToString() + "]", oledbCon)
            oledbCon.Close()
            Dim excelDataSet As New DataSet()
            oledbAdapter.Fill(excelDataSet, "Test")
            Dim excelTable As DataTable = excelDataSet.Tables("Test")
            Dgv.DataSource = excelTable
            With Dgv
                .MasterTemplate.BestFitColumns()
          

Open in new window

0
In the Bartender Label Printing Software, how do I CALL the “CancelPrinting” command in the way in which it includes the “Return to Data Entry Form” Response?
What is the code I would have to write within Bartender's Visual Basic Script Editor?
0
Hello experts.
I have a datatable that gets information from a SQl datatabase
    
Private Sub BuildEmployeeTable()
        Using MySqlDataClass As New SqlData
            With MySqlDataClass
                .SSqlStatement = "EmployeeManagement_Show"
                DtEmployeeTable = .GetSqlData
                DtEmployeeTable.TableName = "DefaultEmployeeDataFromSQL"
            End With
        End Using
    End Sub

Open in new window


I take that datatable and filter it in a dataview:
Private Sub FilterdataSets()
        With EmployeeDv
            .Table = DtEmployeeTable
            If ActiveStatusFilter = Nothing Then
                .RowFilter = EmployeeNameFilter & " And " & DepartmentFilter & " And " & ShiftFilter & " And " &
                RoleFilter & " And " & QualFilter & "And " & PlantFilter
            Else
                .RowFilter = EmployeeNameFilter & " And " & DepartmentFilter & " And " & ShiftFilter & " And " &
                    RoleFilter & " And " & QualFilter & "And " & ActiveStatusFilter & "And " & PlantFilter
            End If

        End With
end sub

Open in new window


Take that dataview and bind it to by datagridview:
  DgemployeeList.DataSource = EmployeeDv

Open in new window


Now the problem i am having is that the datagridview is bound to the dataview and when a new row is added by the user, it adds a row to the datatable but not the dataview.
So when a user enters a new row and switches to another new row, the row disappears from the datagridview because it was committed to the datatable and the dataview hasn't been updated. (I think)

     I have tried in rowleave, detecting if a new datagridview row and updating...but it did not work.

    Private Sub MyRowLeave(sender As Object, e As DataGridViewCellEventArgs)
        If e.RowIndex >= CountOfFilteredRows - 1 Then
            FilterDataSets()
            DgEmployeeList.DataSource = EmployeeDv
        End If
    End Sub

Open in new window



1. Which event should I use to refresh the datagridview?
2.  What code would you suggest to update the datagridview?
Please some sample code would be helpful.

Thanks
K.
0
Hi All,

I have edit a windows form. But when I want to save it fails with message :
Object reference not set to an instance of object.

I try to edit the form from other computer, it works fine.
I replace it to my project at my computer and still happened.

What's is wrong ?

Thank you.
0
Hi guys Im trying Send this command 000000000000001RSN0003GLU BUN CHO 134<EOT> in Serial Port With Vb.Net

And This is my code

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    myPort = IO.Ports.SerialPort.GetPortNames()
    ports.Items.AddRange(myPort)
End Sub

Private Sub btnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
    SerialPort1.PortName = ports.SelectedItem
    SerialPort1.BaudRate = baudrate.SelectedItem
    SerialPort1.DataBits = databits.SelectedItem
    SerialPort1.StopBits = stopbits.SelectedItem
    SerialPort1.Open()
    SerialPort1.RtsEnable = True
    btnConnect.Enabled = False
    btnDisconnect.Enabled = True
End Sub

Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
    SerialPort1.Write(txtPatientNo.Text)
End Sub`
0
All of sudden, I receive this error when running my asp.net app from Visual Studio 2013 and IIS Express - http://localhost:7943/

ERR_CONNECTION_REFUSED

This happens on all browsers and was working fine up until today.

Very strange.

Anyone experience this

*** Found a similar issue on internet, but no solution.
0
Im creating a form. Trying to test buttons on it with the code ive written.

I run debug, form loads for 2 seconds, then it goes back to design mode.

How can I keep it from reverting to design mode, I need to test my buttons.
0
I have a VB.Net program that uses CrystalReports to print an ID card (CR80).
The viewer shows a portion of a full-size letter format, with horizontal & vertical scroll bars.
What programming / controls are needed to:
1. Resize margins to CR80 ~ 2.13" x 3.38".
2. if necessary, remove scroll bars.

Thank you,

Russ
0
SqlStr = "select  ROW_NUMBER() OVER (ORDER BY id) AS [Sno],Employees.EmpID,Employees.contactno,Empname as [Employee Name],WorkType,ClientName,SiteName,Siteschedule.TotalHours AS [Total Working Hours] from Siteschedule inner join clients on clients.clientid=Siteschedule.clientid inner join sites on sites.SiteID=Siteschedule.SiteID  inner join Employees on Employees.EmpID=Siteschedule.empid  where (StartDateValue between " & TxtStartDate.Value.Date.ToOADate & "  and  " & TxtEndDate.Value.Date.ToOADate & ") " & substring
 ambigous column name id
0
When I compile someone c# code, I got the following warning.  What do I need to resolve this? Any idea?

The primary reference "xxxConfiguration" could not be resolved because it has an indirect dependency on the assembly "xxxAsync, Version=7.05.101.0, Culture=neutral, PublicKeyToken=58aa7495915e0000" which was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
0
I want to have a punch in / out functionality by using just a barcode reader to scan the employee barcode then deal with it in the database.

We have only one screen (And the customer does not want to have multi-screens), however), The customer wants to let each employee punch in by scanning his card while the main user is using the application. How can I do that (As if I have 2 separate computers one for punch in/out and the other is for the normal cashier and system work?):

1. Is there any global application event which is triggered by keyboard regardless of the active form, and in focus control?
2. Is there any trigger that allows the barcode scanning to start a quick application to perform the functionality and close itself?
3. Is there a possibility to have the main application open, and a punchInOUT application also running (only one screen with one text box), but make the barcode scanning affecting only the punchINOUT application?
4. Any brilliant idea to allow this functionality

Thanks in Advance for help. Please help in VB.NET (I am using VS2010)
0
Hi,
I've got two application in vb.net: One with a form for authentication (App A) and one wich require authentication (App B) to access it
Everything works fine, but it happens this when the session is outdated (ex. i leave App B opened on a page) :

-> i trigger whatever control on the opened App B
->This cause a page load that, checking for login with My.User.IsAuthenticated, redirect me to App A
-> App A ask me to login, and from the logged in menu i select to access App B
-> On PageLoad, App B chek again for My.User.IsAuthenticated which return false, even if i logged on App A

So i cannot access App B anymore if i don't clear the cache
This happens when the session is outdated, but not if i login/logoff manually

Is there some settings App User that i should check?
0
Playing AVI files in a picture box from dll. .OCX and other files in Visual Basic 10 Express.
I would like to have a complete code that reproduces. avi files in the. dll. OCX and other files in a PictureBox written in Visual Basic 2010 Express.
So to speak for example that it reproduces an AVI file while it is copying a file (I have the code in Visual Basic 6 and I cannot get it to work in Visual Basic 2010 Express).
From what I could understand by reading the various forums in Internet there is also the possibility of embedding an AVI file by transforming it into a resource and uploading it to Visual Basic 10 Express, if it were so it would be good to know how to create that resource, embed it in Visual Basic 10 Express and play it in a picture box while the application is working (always with full code).
is clear transparency effect and continuous play.
I would want complete code to download with any clarifications.
Without wasting time writing code I'm attaching a file containing a working Visual Basic 6 program that I've tried to convert to Visual Basic 10 express in all ways, you might see if it did you and send it back to Visual Basic 10 Express.
Thank you.
0
Code below is supposed to go through a list of word docs, all docs being printed are blank.

Any idea what I could be missing? For now I'm only printing 1 page docs. Would anyone be able to incorporate StreamReader code into there for me? I'm reading a print guide at the moment, would love ideas.

 Imports system
Imports system.Windows
Imports System.Object
Imports System.Windows.Forms


Module Module1


    Sub Main()
         
         Dim files() as String = IO.Directory.GetFiles("C:\Users\Hares1\Desktop\PROGRAMS\DWG")
    
    For Each file In files
       Dim psi As New ProcessStartInfo(file)    
      Try

             
        psi.Verb = "printto"       
        psi.UseShellExecute = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.CreateNoWindow = True 
        Process.Start(psi).WaitForExit(5000)          
      Catch ex As Exception
        Console.WriteLine(File)               
      End Try	  
	Next file	

	
	
	Console.WriteLine("Done.")
	Console.ReadKey()
    End Sub

End Module

Open in new window

0
Code below only prints 1 doc, the first one

I have a few files in my path, but it wont print the rest...
Any ideas?

Imports System
Imports System.IO
 Imports System.Windows.Forms
 Imports System.Windows.Forms.Form
Imports System.Windows.Forms.PrintPreviewDialog




Module Module1


    Sub Main()
        Dim PrintDialog1 As New PrintDialog()
          Dim files() as String = IO.Directory.GetFiles("\\sv-fs03\users$\..........\dwg printer")
    For Each file In files
               
      Try

                 Dim psi As New ProcessStartInfo(file)
        psi.Verb = "print"       
        psi.UseShellExecute = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.CreateNoWindow = True 
        Process.Start(psi).WaitForExit(5000)          
      Catch ex As Exception
        Console.WriteLine(File)               
      End Try   
Next file
        Console.WriteLine("Done.")
Console.ReadKey

        
     

    End Sub

End Module

Open in new window

0
Hello,

Im relative new on Programming using VB.NET but, I want to know how can I use a webservice on Windows Forms app, I have a REST API.

Any idea of how can I do this requirement?.

Regards,
0
Ok, so the below code goes through the files in a folder and prints them ~

What I want to do is for the code to read the docs 1 by 1, since there are problem docs, and thats why i'm creating this~

I'm going to wait for a sleep timer on the docs that wont print ~

hence why I want the process to run once for each doc

How would i run the PSI process once for each doc (in this case filepath), then loop back to the beginning of the process...?
Module Module1


            Sub Main()
  
         For Each filePath In IO.Directory.GetFiles("......\Desktop\PROGRAMS\DWG")
    Try
        Dim psi As New ProcessStartInfo(filePath)
 
        If 1=1

                

            psi.Verb = "print"

                  

        
            psi.UseShellExecute = True
            psi.WindowStyle = ProcessWindowStyle.Hidden
            psi.CreateNoWindow = True
 
            Process.Start(psi).WaitForExit(5000)

          
        Else
            Console.WriteLine("No 'print' verb associated with file extension " & IO.Path.GetExtension(filePath))
        End If
    Catch ex As Exception
        Console.WriteLine(ex.ToString(filepath))
               
    End Try
             Console.ReadKey()
Next
       End Sub


End Module



  
      

Open in new window

0
Hello..

How to send text message in vb.net by sms.>
0
I need the Print dialog box to show up through a console APP I'm creating ~

I've seen articles mentioning how to do this on a form using:  
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    ' print the document
End If

However this will be a console APP where the user clicks the exe, I want the printer dialogue box to open up, once the user chooses print settings I want all the docs in the folder to be printed. basically I'll be placing the dialogue box code at the top level.

Any ideas on how to do this?
0
How can I print all the files in a folder (the same extension) to another folder in the system.

I have various methods I want to invoke on the documents, so I need a print method, not a copy...

Any clues at all?
0
VB.NET PRINT files in one folder to the next -

Basically I want to print all the files in one folder, to another folder on the system.

Could someone give me one or 2 lines of code for doing this?

When I do   psi.Verb = "print"  this is printing out on physical paper.   I want to actually print it to the system. This is driving me nuts.
0
I'm printing a set of docs in a folder ~ I want to print it to the filesystem, basically an adjacent directory.

I actually have everything I need, except printing it to the file system as opposed to printer output.

I'm using process.startinfo method of course ~

any ideas where i may be able to look to, or even better, any suggestions?
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,