Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by lrbrister
at 2024-07-31 08:48:41
Point:500 Replies:5 POST_ID:828645USER_ID:11516
Topic:
Microsoft Visual Basic.Net;.NET;Microsoft Development
I have a datatable that I add rows to in a "missing id" process
missingPhoneTable.Rows.Add(extractedPhoneNumber)
How do I make sure that I only add that if it doesn't already exist?
missingPhoneTable.Rows.Add(extractedPhoneNumber)
How do I make sure that I only add that if it doesn't already exist?
Author: lrbrister replied at 2024-08-02 06:17:51
Clean...thanks
Accepted Solution
Expert: CodeCruiser replied at 2024-08-01 09:08:25
500 points EXCELLENT
Here
missingPhoneTable.DefaultView.RowFilter = "PhoneNumber=" & extractedPhoneNumber
If missingPhoneTable.DefaultView.Count = 0 Then
missingPhoneTable.Rows.Add(extractedPhoneNumber)
End If
*PhoneNumber is the column name so replace it with whatever column name you have
** Assumed that extractedPhoneNumber is the string containing the value that want to check. Otherwise, replace accordingly.
missingPhoneTable.DefaultView.RowFilter = "PhoneNumber=" & extractedPhoneNumber
If missingPhoneTable.DefaultView.Count = 0 Then
missingPhoneTable.Rows.Add(extractedPhoneNumber)
End If
*PhoneNumber is the column name so replace it with whatever column name you have
** Assumed that extractedPhoneNumber is the string containing the value that want to check. Otherwise, replace accordingly.
Expert: duncanb7 replied at 2024-07-31 09:16:37
Untesting code only, please take care of it and hope it 'll help you to start it
Dim a as integerDim i as integerDim fnd as integera = missingPhoneTable.Rows.counti =0fnd=0Do until i>aif missingPhoneTable .Row[i].cells[3].innerText = "extractedPhoneNumber " thenfnd=1elsefnd=0end ifi=i+1loopif fnd = 0 then missingPhoneTable.Rows[i+1].cells[3].innerText="extractedPhoneNumber"End if 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:
Author: lrbrister replied at 2024-07-31 09:00:53
duncanb7
How ?
How ?
Expert: duncanb7 replied at 2024-07-31 08:57:46
If find number of total rows first and check whether there is existing row cell
value is equal to "extractedPhoneNumber" in the total number of rows , If not, add it
Duncan
value is equal to "extractedPhoneNumber" in the total number of rows , If not, add it
Duncan