none
how to remove outside array RRS feed

  • Question

  • hi
    I load the data into datatable .
    I want to delete any char outside the array from dt item 0 .
    I don't want to place an iterative loop inside the existing one to delete the char from items

     
    Dim letter As Char() = {"h", "e", "i", "r", "o"}
      For i = 0 To dt.Rows.Count - 1
    Datag_Clin.Rows.Add(New String() {dt.Rows(i).Item(0).ToString})
    Next





    • Edited by monemas Monday, December 16, 2019 12:06 PM
    Monday, December 16, 2019 7:54 AM

Answers

  • If the data are got from SQL server and you do not need the characters in other places, then maybe adjust the text using SQL functions in your SELECT query that gets the data. See, for example, the REPLACE function (maybe in combination with TRANSLATE).

     

    • Edited by Viorel_MVP Monday, December 16, 2019 8:02 PM
    • Marked as answer by monemas Monday, December 16, 2019 9:19 PM
    Monday, December 16, 2019 8:00 PM
  • Hi monemas,

    Thank you for your reply.
    Don't you use bound source (bound to = datatable)?

    Regards,

    Ashidacchi -- http://hokusosha.com

    • Marked as answer by monemas Monday, December 16, 2019 9:19 PM
    Monday, December 16, 2019 1:13 PM

All replies

  • WHAT?

    Regards Les, Livingston, Scotland

    Monday, December 16, 2019 12:01 PM
  • Hi monemas,

    I hope you will specify what "dt" and "Datag_Clin" is, what their data-type are.
    We cannot expect others to understand what we know.

    Regards,

    Ashidacchi -- http://hokusosha.com


    • Edited by Ashidacchi Monday, December 16, 2019 12:08 PM
    Monday, December 16, 2019 12:05 PM
  • Hi monemas,

    I hope you will specify what "dt" and "Datag_Clin" is, what their data-type are.

    Regards,

    Ashidacchi -- http://hokusosha.com

    Datag_Clin = datagridview
    dt=dataTable
    What  I do filling the datagridview from datatable
    Monday, December 16, 2019 12:13 PM

  • I don't want to place an iterative loop inside the existing one to delete the char from items

       




    Monemas, it seems you have some idea's about programming which are false. For this kind of operations always an iteratieve loop is used. If it is not by you then it is done by the expression you use. That is also the way with for Instance Linq, but even a method like replace uses internal an iterative loop.

    It is mostly if it is done in an expression or method faster. But the effect is absolute zero for a desktop program language as Visual Basic. The eyes of the end user are not fast enough to recognise it. (If you do a step by step debug then you can see it, but that is of course not real time).

     

    Success
    Cor


    Monday, December 16, 2019 12:13 PM

  • I don't want to place an iterative loop inside the existing one to delete the char from items

       




    Monemas, it seems you have some idea's about programming which are false. For this kind of operations always an iteratieve loop is used. If it is not by you then it is done by the expression you use. That is also the way with for Instance Linq, but even a method like replace uses internal an iterative loop.

    It is mostly if it is done in an expression or method faster. But the effect is absolute zero for a desktop program language as Visual Basic. The eyes of the end user are not fast enough to recognise it. (If you do a step by step debug then you can see it, but that is of course not real time).

     

    Success
    Cor


    Hi

    Do you have a specific way for me to try out the code time?
    Ignore the request
    "I don't want to place an iterative loop inside the existing one to delete the char from items"
    Monday, December 16, 2019 12:27 PM
  • Hi monemas,

    Thank you for your reply.
    Don't you use bound source (bound to = datatable)?

    Regards,

    Ashidacchi -- http://hokusosha.com

    • Marked as answer by monemas Monday, December 16, 2019 9:19 PM
    Monday, December 16, 2019 1:13 PM
  • If the data are got from SQL server and you do not need the characters in other places, then maybe adjust the text using SQL functions in your SELECT query that gets the data. See, for example, the REPLACE function (maybe in combination with TRANSLATE).

     

    • Edited by Viorel_MVP Monday, December 16, 2019 8:02 PM
    • Marked as answer by monemas Monday, December 16, 2019 9:19 PM
    Monday, December 16, 2019 8:00 PM