i'm trying to get my program to look up a string and find a match in an access database in column "PhoneNumber" and return the value from column "FullName" on the same row to a different string
so it would go like this: (i really don't know much about accessing databases)
Dim PhoneNumber As String Dim FullName As String PhoneNumber = TextBox1.Text FullName =
I need to sort a DataTable or DataGridView by a column that is a string value, but with null/empty values at the BOTTOM when sorting ASCENDING. The DataTable is NOT populated by a SQL statement, so no order by. If I do
I need to sort a DataTable or DataGridView by a column that is a string value, but with null/empty values at the BOTTOM when sorting ASCENDING.The DataTable is NOT populated by a SQL statement, so no order by.If I doDataGridView1.Sort(New RowComparer(System.ComponentModel.ListSortDirection.Ascending))then it throws an exception, saying that the DataGridView is DataBound, which is correct, but doesn't help me, and I want to keep it databound.
While writing an app that uses a couple settings, they occasionally get re-set to empty. I haven't seen any pattern to this, but I do have a vague memory that there are certain circumstances that will reset the settings in a project under development. What are the circumstances that cause the settings to be reset?
This must've have been asked before but I couldn't locate it. In a mixed code project (VB and C#) we were debugging some old Visual Basic code where a statement as follows could be found:
If Request.Params("xxx") <> "" Then 'do something
I considered this a bug as Request.Params could be null, in which case the statement would've become false which wasn't the idea. So I thought. I just found out, -- probably for the tenth time and I will keep forgetting -- that the following two statements are not equal, while Nothing in VB should be equal to null in C# (thought I):
if(String.Empty == null) // always false If String.Empty = Nothing Then ' always true
Should I dismiss this as a typical Microsoft backward compatibility effort, or should I consider this a huge error in the VB.NET compiler? Does anybody know the Microsoftean opinion on this oddity?
Using VB.Net If the grid cell value is empty, i am getting error as "Conversion from string "" to type 'Double' is not valid"Code (gridview_CellLeave)
Dim z1, z2, z3, z4 As Int32 If grvList.CurrentRow.Cells(1).Value <> "" Then z1 = grvList.CurrentRow.Cells(1).Value End If If grvList.CurrentRow.Cells(2).Value <> "" Then
I have a form in an application that I'm building that shows a datagridview with the last field being a checkbox. What I'm attempting to do is if the user clicks on the checkbox and then clicking on "Save Changes" all of the fields on that datagridview row (except the first field) is then saved to a database. I have the following [Code] The error I keep getting is "Insert Error: Column name or number of supplied values does not match table definition.".
Im trying to work out what the best way to match 2 strings together, but with a difference.
String1 = "dog cat bird chair book table" String2 = "the dog chassed the cat around the chair"
No I know I can break string1 up by space character and check if each word appears in string 2, I would prefer to not have to do that.If there some sought of regex that would take a group of words and retrun how many of them matched ?
I have a form in an application that I'm building that shows a datagridview with the last field being a checkbox. What I'm attempting to do is if the user clicks on the checkbox and then clicking on "Save Changes" all of the fields on that datagridview row (except the first field) is then saved to a database. I have the following
Private Sub holidaysaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles holidaysaveButton.Click For Each dr As DataGridViewRow In DataGridView1.Rows
is there a way to show in datagrid only those row that has column that is empty, im using this code Me.DataGridView1.DataSource = ds.Tables("0").Copy() but it shows all the data from my table.
I am trying to get this to iterate and append the items in my listbox, which are single column excel files into a single sheet. However, for some reason its placing my second data set out in the bottom of the sheet. I feel like I'm probably missing something very basic here and I've been looking at for to long this afternoon. I used to create this worked splendidly in some other applications I've been developing.
vb version is 2008 VB express excel version is 10.0
Code: For Each filename In ListBox3.Items If System.IO.File.Exists(filename) = True Then xlBook = CType(xlApp.Workbooks.Open(filename), Excel.Workbook)
I am using TextFieldParser to Read a Tab Delimited Text DataFile. The problem I have is that some times the data file (3rd party provided) contains an extra Tab which therefore creates an extra column. I need to remove this unnecessary column. Some columns will have rows that are empty so I cant just delete the column if it has a blank row, So I think I need to loop through each column and if if every row is blacnk then delete that column.
Here is the code that reads the file, I was going to remove the column from the table called table before I populate the table called dtAll , which is what my program uses Dim safeFileName As String = IO.Path.GetFileName(Me.OpenFileDialog1.FileName) Using myReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(safeFileName) myReader.SetDelimiters(vbTab) Dim currentRow As String() [Code] .....
Ok i have a weird issue. I cant figure out what to use... CSV has two colums :-Name, MobileJohn Doe,60002000Jane Doe,Now i would like to delete the whole line if mobile number is empty.. i cant figure out what to use. Mobile number are 8 digits long.
I was trying to call a method using Reflection on a method that has a STRING parameter.However a STRING does not have a parameterless constructor.So instead of something like.>>
Option Strict On Option Explicit On Option Infer Off Public Class Form1
i have a string array that i want to output to a text file. the array size is 10000. i fill the array starting from 0 with some strings. at the end, i only want to show the array from index 256 to the last array that is not empty (for eg. if the array is filled with data from 0 to 2000, i only want the text file to show the data from 256 to 2000 and ignore the remaining strings). Is there any function to do this?t i use is shown below
Dim myArray(10000) as string Dim strArray As New System.IO.StreamWriter("c:List.txt") strArray.WriteLine("{0,10}{1,30}", "Index", "Symbol")
My requirement is to read all rows of an excel-sheet in first column that are not empty, are numeric and have a length between 15 and 20.
For example: 358218033354974 359473035499561 358218036156129 354022038366247 358218032490035 359473030516492 353210040325399
This column might have a header that is not numeric and there might be empty rows. This would cause an exception when importing them via SqlBulkCopy. So i want to prefilter the correct rows via OleDbCommand.
What I have tried so far is following(C# is also appreciated): Using connection As New OleDbConnection(sExcelConnectionString) connection.Open() Dim schemaTable As DataTable = _ connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "TABLE"}) [Code] .....
But this throws an exception if there are empty rows or the format of the value is incorrect. So my question is: How to restrict the rows of OleDbCommand to: Get only first column of every worksheet All values that are numeric Skip empty values Ideally only the values with a length between 15 and 20
Any way how to skip the empty rows, Or do I have to to select the whole datatable? I hoped it would be possible to do that only with one query because of performance reasons.