Questions tagged [vb.net]

24005 questions
1

votes
2

answer
2.2k

Views

How to use Function VB.NET Insert To Database?

i using function with vb.net. i'm query sql to datagridview and insert data from datagridview to Databse By function. But Error in function: The name 'EXHBK13004' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted. i wa...
nettoon493
1

votes
2

answer
62

Views

Remove the character alone from the string

My code retrieves the data from various resources . And output will be like below UNY4/4/2010 hds04/5/2010 saths04/22/2013 But I want the output like this 4/4/2010 4/5/2010 04/22/2013 Is there any way to do this ?
Sathish K
1

votes
2

answer
7.7k

Views

Mouse click and hold event?

Does anyone have an idea how to handle a mouse click and hold event in VB.NET? Suppose I want to click and hold in a button and do some stuff behind the code like change the button BackColor or close a window faster( just like when you click in the ms office 2013 file menu then use a left-arrow to...
Milot25
1

votes
2

answer
594

Views

Implicit reference to object under construction is not valid when calling another constructor

I am trying following Within my MVC Controller: Private ProductRepoitory As IProductRepository Sub New() Me.New(New productsRepository(New ModelStateWrapper(Me.ModelState))) End Sub Sub New(ByVal repo As productsRepository) ProductRepoitory = repo End Sub However this line throws following Error mes...
highwingers
1

votes
2

answer
664

Views

Set the path from an OpenFileDialog to a variable

I have the following code to set the filename from a OpenFileDialog to a variable: Dim OpenDLG As New OpenFileDialog File = OpenDLG.FileName.ToString() Dim xPath As String = File Dim ArrPath() = xPath.Split("\") Dim wPathLong = ArrPath(ArrPath.Length - 1) But now I want to have the same for the Path...
RalJans
1

votes
2

answer
1.6k

Views

Handling exception at application level

I have a vb.net main desktop application and there are also supporting applications of the main application. I have to do exception handling for all the methods in the application but don't want to put try catch in each and every method or event click. Is there any centralized way of exception handl...
user3060430
1

votes
4

answer
7.5k

Views

Delete last row in datagridview

I’m trying to delete the last row of a datagridview programmatically, but I’m unable. Here’s what I’ve tried so far: DataGridView1.Rows.RemoveAt(DataGridView1.Rows.Count - 1) I’ve also tried to select last row and then delete it, but that hasn’t worked either Me.DataGridView1.Rows(Me.Da...
user3080392
1

votes
2

answer
21.9k

Views

how to use placeholder for Textbox in VB.Net 2010 like html

I have a form that does some mathematical calculation. I want to be able users to enter data quickly without erasing the value. I thing its good to use placeholder like I did in html but how can i use it in VB.Net 2010? Thanks Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System....
ensberiyu
1

votes
1

answer
1.4k

Views

Crystal Report Crosstab String Data

I have a datatable that looks like this (all columns have string datatype) firstCol secondCol thirdCol 1_str1 1_str2 5,1 2_str1 2_str2 5 3_str1 3_str2 .... .... .... note that on the thirdCol, some fields are blank. as for the crystal report, I have used th...
Codemunkeee
1

votes
0

answer
6

Views

Cannot import data into pdf checkbox using iText

We are using itext in Vb .net we are importing data from an excel spreadsheet and filling in the fields from the spreadsheet. We get everything except for the checkboxes, we are not sure how to handle checking them(They are Either Yes/No ) The internet says to use GetAppearanceState, but not working...
Michael
1

votes
1

answer
103

Views

VisualBasic order List by Property as String

I've got an List of an Custom Class and want to order this List by an Property, but I only have the String of the Property name, becasue I recive this from an javascript. I tried this with System.Reflection, but it seem, that it isn't working: Dim l As List(Of ActionElement) = New List(Of ActionElem...
Cedric Krause
1

votes
2

answer
5.5k

Views

iTextSharp - Document has no pages when working with table

Dim doc As New Document() Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(doc, New FileStream("Invoice.pdf", FileMode.Create)) doc.Open() Dim table As New PdfPTable(6) table.WidthPercentage = 110 Dim cellDate As New PdfPCell(New Phrase("9/10/14")) cellDate.Colspan = 2 table.AddCell(cellDate) Dim c...
jgetrost
1

votes
2

answer
9.3k

Views

Creating a Google Calendar event in VB

I'm trying to create a Google Calendar Event in Visual Basic using the Google Api v3. I've managed to authenticate and get events from the calendar but I'm not sure how to save events and the documentation isn't very helpful. Here's my current code: Imports System.Collections.Generic Imports System...
Mojachiee
0

votes
0

answer
5

Views

Issues with class instantiation after converting VS 2005 project to VS 2017

I'm working on getting a (badly written) VB web app up to something approaching modernity by converting it off a VM running visual studio 2005 and into VS 2017. The solution conversion went smoothly however when I try to compile it throws around 1k errors that are instantiations of user defined cla...
Zoidfarb
1

votes
2

answer
15.4k

Views

HOW TO FILL COMBO BOX IN VB.NET

I have a code to fill my combo box but every time i close the form the list is being doubled, if i have a list from my database of English, Mathematics, Science after i close the form and open it again the list showing is now English, Mathematics, Science, English, Mathematics, Science HERE IS THE C...
Kemmy
1

votes
1

answer
405

Views

Use running instance to execute commandline in vb.net

I'd like to use a running instance of my application (a single instance application) to run a new commandline... I've heard about mutexes and IPC mechanisms but I don't know how to use it. Explanation : Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load M...
Drarig29
1

votes
1

answer
99

Views

Replace ignores non-capture group

Why does Regex.Replace ignore my non-capturing group? I am removing bracketed numbers that occur at the end of a filename, whether this is followed by 0, 1 or 2 extensions. For example, whatever(54).xml will become whatever.xml This doesn't work: Private Function FixFileName(ByVal fn As String) As...
Andy G
1

votes
1

answer
2.4k

Views

DataGrid LostFocus Event Raised when User Changes Row

Here is the XAML used to create a datagrid: Here is how I bind data to the grid ("Sequence" is a column in the RepairComments table): RepairFilter= dvComments = New DataView(dsPIM.Tables("RepairDetails"), RepairFilter, "Sequence", DataViewRowState.CurrentRows) dgrComments.ItemsSource = dvComments Th...
SezMe
0

votes
0

answer
11

Views

Triggering the breakpoint in vb6 using vb.net

Currently, I have a main project developed in vb.net. This project has a sub-application developed in vb6 called when running a command, for example: Public Sub ECommand(ByVal strECommand as String) If Not strEcommand = Nothing Then 'Call VB6 Form. End if...
1

votes
0

answer
12

Views

Export data to txt file with fixed formated fields

I've a code in vb that export data from datatable to a formated txt file. I've been using this code and it works, but there's a field in datable with long texts. I'd like to breake this records into multiple lines to fit a fixed-width column. The below code write all records in a unique line. writer...
Iron Man
0

votes
0

answer
5

Views

What is happening when an IAppBuilder function/sub is called?

I have been learning how to setup SignalR. My sample projects work correctly, but there are things happening that I don't understand. The project is an MVC website. The instructions called for a Startup Class which I added, and it includes a single method: Public Sub Configuration(ByVal app As IA...
Alan
1

votes
1

answer
975

Views

How to change textbox.text while in backgroundworker?

I just want to change an textbox text while I am in the backgroundworker. What I have is: Private Sub ... Dim powershellWorker As New BackgroundWorker AddHandler powershellWorker.DoWork, AddressOf BackgroundWorker1_DoWork powershellWorker.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork...
hannir
1

votes
2

answer
1.9k

Views

How to count: Datatable.rows.count excluding deleted rows

I'm constantly doing this to avoid removed/deleted rows from my dataset. For Each drX As DataRow In myDataset.Tables("CustInno").Rows If drX.RowState DataRowState.Deleted Then iRunRows += 1 End If Next is there a quicker or better way to do this?
Ivan Perez
1

votes
1

answer
425

Views

COMException occurred - Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) when trying to modify an existing excel file

3rd line returns COMException. oBooks.GetType().Invoke... Dim oBooks As Microsoft.Office.Interop.Excel.Workbook = Me.fOpenXlsFile(strXLSFile) Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US") oBooks.GetType().InvokeMember("Add", Reflection.BindingFlags.Invoke...
SamekaTV
1

votes
2

answer
1k

Views

select where date (only date from datetime)

how can I search for a records in the database (sql server) where date dd/mm/yyyy from date format dd/mm/yyyy h:mm:ss . if the column is date it's work fine but when I make it datetime and want to see if there's records in database in specific date it's different because there's time. so how can i s...
Rabeea qabaha
1

votes
1

answer
680

Views

CefSharp - no copy shortcut menu item

I recently added cefsharp from nuget to a project in visual studio. It's working with browsing and all but I need my user to be able to copy his email address from the browser by right clickong on it clicking on copy shortcut. But cefsharp is only showing 4 options - back, forward, print, view sourc...
Tyler Humphry
1

votes
0

answer
12

Views

How do I correctly use the OpenWriteAsync method to POST a file to an URL?

I have been using the UploadFileAsync method to complete a file upload to remote server until it encounters a file above around 1gb where the RAM will spike to this filesize and crash the application. A little research has to lead me to the OpenWriteAsync function to write as a filestream instead of...
Nookster
0

votes
2

answer
32

Views

VB.Net Delete data from Dictionary from SelectedValue in listbox

I'm having trouble deleting data from my dictionary. I want whichever data is highlighted in the list box to be removed from the dictionary when the Delete Library button is clicked. After it is removed it will repopulate the list with the updated dictionary. Public Class frmManager Dim Libraries...
Devin
0

votes
0

answer
5

Views

Wpf TextBlock VerticalAlignment=“Center” doesnt work

Following code produces this output: https://prnt.sc/mm655n My question is here: https://prnt.sc/mm66at
user10609406
0

votes
1

answer
11

Views

Vb.net Iterate over dictionary to refresh the listbox item property

I'm trying to create a sorted dictionary libraries where it will be filled with a libraries full name and the acronym if the building name. However, I'm having issues accessing the data I created and printing it in the listbox. Getting the error 'Libraries' is not declared. It may be inaccessible du...
Devin
0

votes
0

answer
12

Views

Disable Image Blending on PictureBox in Forms App

In my Windows forms program, I have a PictureBox, but the bitmap image inside it is small, like 5x5, and I want to disable it's image blending, it's very blurry. I tried finding something like blending mode, blurring mode, or anti-aliasing mode, but I had no luck. It's a bitmap image, by the way. Th...
TheRealSuicune
0

votes
0

answer
5

Views

Generate A Blank Image From Width And Height In VB.NET

I want to make a blank canvas bitmap image with a certain width and height, in VB.NET, I am using Visual Studio 2017, with a Windows Forms Application, and .NET Framework 4.6.1. I tried creating a new bitmap image based of a new image with parameters of the width and height, but that didn't really w...
TheRealSuicune
0

votes
1

answer
15

Views

get last inserted primary key record in database

Please help to get the primary key of the last insert record as the one which i have gives me duplicate rows in the database and return 0 Try If Conn.State = ConnectionState.Open Then Conn.Close() 'insert the new customer data Conn.Open() cmd = New SqlCommand("insert into Quote values ('" & dateOFCr...
0

votes
0

answer
5

Views

Understanding MongoDb when switching from mySQL

I am working for a long period of time with using mySQL as preferred SQL Database. Now I have to start a new Project, where I think of using NOSql Database, because of it's open data structure. But I am not understanding a couple of Things. And Maybe someone could help to explain. In mySQL I have a...
Zero-G.
1

votes
2

answer
3k

Views

How to upload photos to Instagram using web request

My question is how to upload photos to Instagram using the web request ? In my opinion, That can be done by capturing the web request sent by Instagram Application on Android device and write it in any desktop language like c# or vb. I tried to connect Fiddler on desktop to my Android device but I c...
Youssef13
0

votes
0

answer
8

Views

Consolidating DGV columns into a 2nd DGV

Consolidating data in a DGV. Hello, I’m looking for help trying to load data from a DGV with data from a column that has been added together and duplicate names removed, into a 2nd DGV. Example data I’m loading: NAME1 | 0 NAME1 | 2 NAME1 | 3 NAME2 | 1 NAME2 | 1 My desired result would be to...
1

votes
1

answer
3.3k

Views

How to create a table using PDFsharp?

Just started using PDFsharp and it works fine, but now I want to create tables in my PDF, but tried other sources and found nothing. So far I know how to use graph.drawString().
Percival Rapha
0

votes
0

answer
17

Views

Can't access vba pointer from vb.net

When write to vba variable address from vb.net, vb.net application crash. My code is below. What is wrong? Dim p As IntPtr = 1818036 'vba memory addres by varptr Marshal.WriteByte(p, 100)
Zeki Gürsoy
1

votes
2

answer
55

Views

check every line in the listview in vb.net?

I Have a List View in my form and the listview have alot of items in there I want to check every line on the list view if the line have A Special string like 127.0.0.1 the line will be deleted I tried to do this there is my code Dim was As Integer For Each item In ListView1.Items was = ListView1....
hath hassan
0

votes
0

answer
17

Views

XSS Attack security in webforms

I have created a asp.net webforms application. I am blocking the users to submit any script. For that I have implemented the ValidateRequest=true in the page section and in the web.config as well, which works fine when i try to submit any XSS data from controls like from a textbox. It shows me the e...
Rober

View additional questions