Click here to Skip to main content
15,897,334 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: formatting numbers from a text box Pin
Mycroft Holmes16-Jul-08 20:17
professionalMycroft Holmes16-Jul-08 20:17 
GeneralRe: formatting numbers from a text box Pin
digicd122-Jul-08 10:49
digicd122-Jul-08 10:49 
QuestionORA-06502: PL/SQL: numeric or value error: character string buffer too smal Pin
ljammala16-Jul-08 10:39
ljammala16-Jul-08 10:39 
AnswerRe: ORA-06502: PL/SQL: numeric or value error: character string buffer too smal Pin
Mycroft Holmes16-Jul-08 20:22
professionalMycroft Holmes16-Jul-08 20:22 
GeneralRe: ORA-06502: PL/SQL: numeric or value error: character string buffer too smal Pin
ljammala17-Jul-08 2:15
ljammala17-Jul-08 2:15 
GeneralRe: ORA-06502: PL/SQL: numeric or value error: character string buffer too smal Pin
ljammala17-Jul-08 2:24
ljammala17-Jul-08 2:24 
QuestionNew Data Row Pin
zzsoulzz16-Jul-08 5:50
zzsoulzz16-Jul-08 5:50 
AnswerRe: New Data Row Pin
nlarson1116-Jul-08 6:52
nlarson1116-Jul-08 6:52 
You are really need to pay attention to the order of execution (what executes next)

Dim dr As DataRow

#1) you are creating a new instance and then turning around and replacing it
Dim dt As New DataTable
dt = objDataSet.Tables(0)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dim dt2 As New DataTable

For Each dr In dt.Rows
For i As Integer = 0 To dt.Columns.Count - 1

If dr(i).ToString = TextBox1.Text Then

#2) you are creating columns inside the for next loop
Dim arData() As Object = {dr(0), dr(1), dr(2)}
dt2.Columns.Add("IC Roll")
dt2.Columns.Add("F2")
dt2.Columns.Add("F3")
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#3)you ask for a new row -- you replaced your variable in your for next loop and you never populate it nor give it to any table
dr = dt2.NewRow()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

dt2.Rows.Add(arData)

Exit For
End If
Next
DataGrid2.DataSource = dt2
Next

<<<<<<<<<<>>>>>>>>>>>>>
should look like this

Dim dr As DataRow, drNew as DataRow
Dim dt As DataTable = objDataSet.Tables(0)
Dim dt2 As New DataTable

dt2.Columns.Add("IC Roll")
dt2.Columns.Add("F2")
dt2.Columns.Add("F3")

For Each dr In dt.Rows
   For i As Integer = 0 To dt.Columns.Count - 1
      If dr(i).ToString = TextBox1.Text Then
         drNew = dt2.NewRow
         drNew(0) = dr(0)
         drNew(1) = dr(1)
         drNew(2) = dr(2)

         dt2.Rows.Add(drNew)
         drNew = Nothing
         Exit For
      End If
   Next
Next

DataGrid2.DataSource = dt2


'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous


AnswerRe: New Data Row Pin
paas16-Jul-08 6:59
paas16-Jul-08 6:59 
QuestionCalculating intervals using Dates Pin
KrisnNala16-Jul-08 5:41
KrisnNala16-Jul-08 5:41 
AnswerRe: Calculating intervals using Dates Pin
Luc Pattyn16-Jul-08 6:20
sitebuilderLuc Pattyn16-Jul-08 6:20 
GeneralRe: Calculating intervals using Dates Pin
KrisnNala16-Jul-08 7:21
KrisnNala16-Jul-08 7:21 
GeneralRe: Calculating intervals using Dates Pin
Luc Pattyn16-Jul-08 7:24
sitebuilderLuc Pattyn16-Jul-08 7:24 
GeneralRe: Calculating intervals using Dates Pin
KrisnNala16-Jul-08 7:34
KrisnNala16-Jul-08 7:34 
AnswerRe: Calculating intervals using Dates Pin
Guffa16-Jul-08 10:18
Guffa16-Jul-08 10:18 
AnswerRe: Calculating intervals using Dates Pin
Guffa16-Jul-08 10:18
Guffa16-Jul-08 10:18 
GeneralRe: Calculating intervals using Dates Pin
KrisnNala16-Jul-08 22:39
KrisnNala16-Jul-08 22:39 
GeneralRe: Calculating intervals using Dates Pin
Guffa17-Jul-08 1:15
Guffa17-Jul-08 1:15 
GeneralRe: Calculating intervals using Dates Pin
KrisnNala17-Jul-08 4:13
KrisnNala17-Jul-08 4:13 
QuestionHow to compile solution with mutliple project types properly? Pin
Jon_Boy16-Jul-08 4:09
Jon_Boy16-Jul-08 4:09 
AnswerRe: How to compile solution with mutliple project types properly? Pin
Paul Conrad16-Jul-08 4:32
professionalPaul Conrad16-Jul-08 4:32 
GeneralRe: How to compile solution with mutliple project types properly? Pin
Jon_Boy16-Jul-08 6:15
Jon_Boy16-Jul-08 6:15 
GeneralRe: How to compile solution with mutliple project types properly? Pin
darkelv16-Jul-08 15:58
darkelv16-Jul-08 15:58 
Questionreferencing ocx file Pin
swapg16-Jul-08 3:41
swapg16-Jul-08 3:41 
QuestionRe: referencing ocx file Pin
Paul Conrad16-Jul-08 4:33
professionalPaul Conrad16-Jul-08 4:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.