Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

VB.NET Programming Corner!

patulong po ako ... :] vb .net .. naka background worker po ako ... yung process ng string manipulation . then sa workcompleted po nakalagay yung pag aadd dun sa listview with multiple columns ... paano ko ba maavoid yung freezing ng UI? :/ help po .. deadline ko na sa friday . hahahah

Wag sa WorkCompleted, dapat sa DoWork mo ilagay ang code ng pag-populate mo ng listview.

- - - Updated - - -

Madami bang record ang nilalagay mo sa listview?
 
patulong po ako ... :] vb .net .. naka background worker po ako ... yung process ng string manipulation . then sa workcompleted po nakalagay yung pag aadd dun sa listview with multiple columns ... paano ko ba maavoid yung freezing ng UI? :/ help po .. deadline ko na sa friday . hahahah

pakita ng code mo pre para matulungan ka namin.
 
Wag sa WorkCompleted, dapat sa DoWork mo ilagay ang code ng pag-populate mo ng listview.

- - - Updated - - -

Madami bang record ang nilalagay mo sa listview?

Master mag crossthread error yun sa DoWork unless nag create ka ng listview sa loob ng DoWork.
If sa Design nag add ng listview pwede mo lang iedit ang properties nun sa progress changed or sa completed events.

@kudeta
kung nag background worker ka bkt mag freeze ang UI mo? nag freeze ang UI pag same thread nag execute ng trabaho at display ng UI. hence ang use ng background worker. sa background mag work.
kung loop additem ang ginagamit mo sa pag populate ng listview icall mo ang progresschanged dun mo iadd. pwede ka pa mag lagay ng progress bar pag ganun.
 
Last edited:
ask ko lng po kung pwede po ba sa P.O. ito

ung ibang item na received partialy..
then ung iba ay cancelled..

anong magandang way para dun pagdating sa payment

then pano kaya rin ung process sa account payable nun??
thanks
 
Wag sa WorkCompleted, dapat sa DoWork mo ilagay ang code ng pag-populate mo ng listview.

- - - Updated - - -

Madami bang record ang nilalagay mo sa listview?
s t
pakita ng code mo pre para matulungan ka namin.


ok na ko mga sirs .. naayus ko na po .. :]

Master mag crossthread error yun sa DoWork unless nag create ka ng listview sa loob ng DoWork.
If sa Design nag add ng listview pwede mo lang iedit ang properties nun sa progress changed or sa completed events.

@kudeta
kung nag background worker ka bkt mag freeze ang UI mo? nag freeze ang UI pag same thread nag execute ng trabaho at display ng UI. hence ang use ng background worker. sa background mag work.
kung loop additem ang ginagamit mo sa pag populate ng listview icall mo ang progresschanged dun mo iadd. pwede ka pa mag lagay ng progress bar pag ganun.

nag freeze po ... yung process lang po kc yung nasa bgworker ko ..nilagay ko muna sa array yung mga iaad ko .... tapos yung pag lagay ng ng items sa listview ee madami po kc ... :] .. nasa dowork ko na lagay yung string to array anyways ... thank you po ... solved na :]


anyways eto po yung coding ko... system ko po sending sms using at commands. tapos contacts and lahat nasa database :]

Imports System.Management
Imports System.Threading
Imports System.Text.RegularExpressions
Public Class Form1

Public Sub New()
InitializeComponent()
Form2.Show()
BackgroundWorker1.WorkerSupportsCancellation = True
BackgroundWorker1.WorkerReportsProgress = True
AddHandler BackgroundWorker1.DoWork, AddressOf BackgroundWorker1_DoWork
AddHandler BackgroundWorker1.ProgressChanged, AddressOf BackgroundWorker1_ProgressChanged
AddHandler BackgroundWorker1.RunWorkerCompleted, AddressOf BackgroundWorker1_RunWorkerCompleted

BackgroundWorker2.WorkerSupportsCancellation = True
BackgroundWorker2.WorkerReportsProgress = True
AddHandler BackgroundWorker2.DoWork, AddressOf BackgroundWorker2_DoWork
AddHandler BackgroundWorker2.ProgressChanged, AddressOf BackgroundWorker2_ProgressChanged
AddHandler BackgroundWorker2.RunWorkerCompleted, AddressOf BackgroundWorker2_RunWorkerCompleted
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()

End Sub

Public ports() As String
Public com As String
Public rvcdata As String = ""
Public dslog As New DataSet
Public index As String

Public Sub Invoke(ByVal control As Control, ByVal action As Action)
If control.InvokeRequired Then
control.Invoke(New MethodInvoker(Sub() action()), Nothing)
Else
action.Invoke()
End If
End Sub


Public Sub reading()
ListView1.Invoke(Sub() ListView1.Items.Clear())
Dim lineoftext As String
Dim i As Integer
Dim arytextfile() As String
Dim lineoftexts As String
Dim arytextfiles() As String
Dim my_string, position As String
ListView1.Invoke(Sub() ListView1.BeginUpdate())
lineoftext = rvcdata.ToString

arytextfile = Split(lineoftext, "+CMGL", , CompareMethod.Text)
For i = 2 To UBound(arytextfile)
Dim input As String = arytextfile(i)
Dim result() As String
Dim pattern As String = "{:}|(,"")|("","")"
result = Regex.Split(input, pattern)
Dim lvl As New ListViewItem
Dim concat() As String

Dim array(5) As String
array(0) = "null"
array(1) = result(0)
array(2) = result(2)
my_string = result(4)
position = my_string.Length - 2
my_string = my_string.Remove(position, 2)
dslog = returnQuery("select contact_name from tbl_contacts where contact_num = '" + my_string + "'")
If dslog.Tables(0).Rows.Count = 0 Then
array(3) = my_string

Else
array(3) = dslog.Tables(0).Rows(0).Item("contact_name").ToString
End If

concat = New String() {result(6).Substring(0, 20)}
array(4) = result(6).Substring(0, 20)
lineoftexts = arytextfile(i)
arytextfiles = Split(lineoftexts, "+32""", , CompareMethod.Text)
array(5) = arytextfiles(1)

'message
ListView1.Invoke(Sub() ListView1.Items.Add(New ListViewItem(array)))


If dslog.Tables(0).Rows.Count = 0 Then
noReturnQuery("insert into tbl_messages(message_sendrep, message_desc, message_datetime, message_type)values('" + my_string + "','" + arytextfiles(1) + "','" + result(6).Substring(0, 20).ToString + "','RECEIVED')")
Else
noReturnQuery("insert into tbl_messages(message_sendrep, message_desc, message_datetime, message_type)values('" + dslog.Tables(0).Rows(0).Item("contact_name").ToString + "','" + arytextfiles(1).ToString + "','" + result(6).Substring(0, 20).ToString + "','RECEIVED')")
End If
Next
ListView1.Invoke(Sub() ListView1.EndUpdate())

End Sub





Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork



If SerialPort1.IsOpen Then

With SerialPort1
rvcdata = ""
.Write("AT" & vbCrLf)
Threading.Thread.Sleep(1000)
.Write("AT+CMGF=1" & vbCrLf)
Threading.Thread.Sleep(1000)
.Write("AT+CPMS=""SM""" & vbCrLf)
Threading.Thread.Sleep(1000)
.Write("AT+CMGL=""ALL""" & vbCrLf)
Threading.Thread.Sleep(1000)
'MsgBox(rvcdata.ToString)
'.Write("AT +CMGF =1" & vbCrLf)
''Threading.Thread.Sleep(1000)
'Dim splitnum = 0
'Dim simindex As Integer = 1
'Dim index3 = 3
'Dim index2 = 5
'Dim index1 = 6
'.Write("AT +CMGF = 1" & vbCrLf)

'Threading.Thread.Sleep(100)
'While simindex <> 10
' .Write("AT +CMGR = " & simindex & vbCrLf)
' Threading.Thread.Sleep(100)
' MsgBox(rvcdata.ToString)

' Dim word As String() = Split(rvcdata.ToString, """", 7 + splitnum)

' If word.Length = 5 Then
' Dim word2 As String() = Split(word(index1), "OK", 2 + splitnum)
' ListBox2.Items.Add(word(index3) + "-------------" + word(index2) + "------------" + word2(0))
' Else
' Dim word2 As String() = Split(word(index1), "OK", 2 + splitnum)
' ListBox2.Items.Add(word(index3) + "-------------" + word(index2) + "---------------" + word2(0))

' End If
' ' If (word(3 + 4) = "" And word(1 + 4) = "") Then
' ' GoTo breakloops

' 'End If
' index3 = index3 + 5
' index2 = index2 + 5
' index1 = index1 + 5
' splitnum = splitnum + 6
' simindex = simindex + 1
'End While
End With
End If


reading()
System.Threading.Thread.Sleep(500)

End Sub

Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged

End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
If e.Cancelled = True Then
Me.tbProgress.Text = "Canceled!"
ElseIf e.Error IsNot Nothing Then
Me.tbProgress.Text = "Error: " & e.Error.Message
Else
Me.tbProgress.Text = "Done!"
Timer2.Start()
End If
End Sub


Private Sub BackgroundWorker2_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker2.ProgressChanged

End Sub

Private Sub btn_delete_Click(sender As Object, e As EventArgs) Handles btn_delete.Click
If ListView1.Items.Count = 0 Then
Else
If Not BackgroundWorker2.IsBusy = True Then
index = ListView1.SelectedItems.Item(0).SubItems(1).Text
index = Trim(Replace(index, ":", ""))
BackgroundWorker2.RunWorkerAsync()
End If
End If

End Sub
End Class

- - - Updated - - -

dagdag ko pa po .. d po pwede yung magaccess ng controls dun sa thread na hindi naman siya dun na create .. pero possible na magamit siya sa do work .. invoke po muna yung control para magamit sa do work! :]
 
Last edited:
s t



ok na ko mga sirs .. naayus ko na po .. :]



nag freeze po ... yung process lang po kc yung nasa bgworker ko ..nilagay ko muna sa array yung mga iaad ko .... tapos yung pag lagay ng ng items sa listview ee madami po kc ... :] .. nasa dowork ko na lagay yung string to array anyways ... thank you po ... solved na :]


anyways eto po yung coding ko... system ko po sending sms using at commands. tapos contacts and lahat nasa database :]



- - - Updated - - -

dagdag ko pa po .. d po pwede yung magaccess ng controls dun sa thread na hindi naman siya dun na create .. pero possible na magamit siya sa do work .. invoke po muna yung control para magamit sa do work! :]

mag freeze talaga yun. kaya sya, hindi gagamitin sa do work is para hindi mag freeze during long process.

linawin ko lang din. pwede mag access readonly ng controls pag ibang thread gawa, bawal lang mag set or change ng kahit anong property.
 
Last edited:
Mga master, patulong po sana. Meron akong problem sa pag read ng XML sample po yung sa baba.
Meron po akong header na table which is delivery and detail na table which is delivery_lines.

Ganito po yung pag basa ko ng XML :

Code:
            ds.ReadXml(oFile)
            oHeader = ds.Tables("delivery").Copy
            oDetail = ds.Tables("delivery_line").Copy

Ang problem ko po, paano ko malalaman sa header na eto yung detail niya. Kase kung gagamit po ako ng rowfilter sa details na datatable, wala po akong reference sa header.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<deliveries>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>176</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>reinforcing mesh (f62) 2.4x6m</product_name>
        <product_reference_code>303201</product_reference_code>
        <invoice_serials/>
      </delivery_line>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>2</line_no>
        <product_name>cement - 40 kg paradise</product_name>
        <product_reference_code>300066</product_reference_code>
        <invoice_serials/>
      </delivery_line>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>3</line_no>
        <product_name>tuffa tank 3000ltr petal rg green</product_name>
        <product_reference_code>305761</product_reference_code>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>177</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>coatsaver metal primer red oxide 16l</product_name>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>178</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>brush cutter/trimmer bc260</product_name>
        <product_reference_code>305863</product_reference_code>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
</deliveries>
 
Help po sa quiz program ko. Meron akong 4 choices, 1 is the correct answer sa database (MS ACCESS). Paano ko po mairarandom sa letters A B C D ung choices. Self study lng po kac ako sa vb.net. Sana may makatulong po sa akin. Thanks po sa sasagot.
 
Mga master, patulong po sana. Meron akong problem sa pag read ng XML sample po yung sa baba.
Meron po akong header na table which is delivery and detail na table which is delivery_lines.

Ganito po yung pag basa ko ng XML :

Code:
            ds.ReadXml(oFile)
            oHeader = ds.Tables("delivery").Copy
            oDetail = ds.Tables("delivery_line").Copy

Ang problem ko po, paano ko malalaman sa header na eto yung detail niya. Kase kung gagamit po ako ng rowfilter sa details na datatable, wala po akong reference sa header.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<deliveries>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>176</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>reinforcing mesh (f62) 2.4x6m</product_name>
        <product_reference_code>303201</product_reference_code>
        <invoice_serials/>
      </delivery_line>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>2</line_no>
        <product_name>cement - 40 kg paradise</product_name>
        <product_reference_code>300066</product_reference_code>
        <invoice_serials/>
      </delivery_line>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>3</line_no>
        <product_name>tuffa tank 3000ltr petal rg green</product_name>
        <product_reference_code>305761</product_reference_code>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>177</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>coatsaver metal primer red oxide 16l</product_name>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
  <delivery>
    <created_at>2014-04-30T00:00:00+10:00</created_at>
    <document_no>178</document_no>
    <id>44580</id>
    <invoice_date>2014-04-30T00:00:00+10:00</invoice_date>
    <posted_at>2014-04-30T15:50:08+10:00</posted_at>
    <delivery_lines>
      <delivery_line>
        <delivery_type></delivery_type>
        <line_no>1</line_no>
        <product_name>brush cutter/trimmer bc260</product_name>
        <product_reference_code>305863</product_reference_code>
        <invoice_serials/>
      </delivery_line>
    </delivery_lines>
  </delivery>
</deliveries>

Gamitan mo ng XmlNode

- - - Updated - - -

Help po sa quiz program ko. Meron akong 4 choices, 1 is the correct answer sa database (MS ACCESS). Paano ko po mairarandom sa letters A B C D ung choices. Self study lng po kac ako sa vb.net. Sana may makatulong po sa akin. Thanks po sa sasagot.

Use Random.Next()
 
patulong po ako ... :] vb .net .. naka background worker po ako ... yung process ng string manipulation . then sa workcompleted po nakalagay yung pag aadd dun sa listview with multiple columns ... paano ko ba maavoid yung freezing ng UI? :/ help po .. deadline ko na sa friday . hahahah

Imports System.Windows.Forms

Application.DoEvents() <--- lagay mo sa doevents

- - - Updated - - -

mag freeze talaga yun. kaya sya, hindi gagamitin sa do work is para hindi mag freeze during long process.

linawin ko lang din. pwede mag access readonly ng controls pag ibang thread gawa, bawal lang mag set or change ng kahit anong property.

i think pwede mag set via delegate or invoke
 
Imports System.Windows.Forms

Application.DoEvents() <--- lagay mo sa doevents

- - - Updated - - -



i think pwede mag set via delegate or invoke

I mean po by default. since nag ibang thread na din naman bkt dun pa iprocess yon pag alter ng UI, i'd prefer ibalik nlng sa unang thread.
 
pa tambay rin po dito.. marami din ako makukuha sa inyo at gusto ko rin mag share kung anong meron ako..;)
 
Ask ko lng po about sa receiving ng goods...

Invoice ung ibinibigay ng nag deliver na supplier.
tapos icocompare ko sya sa na approve n P.O..
then pano pag may mga charge si Supplier?

ex. endi free delivery na kasama sa Invoice.. anong way para dun??
so another table for that ?? salamat sa reply.. :)

- - - Updated - - -

Ask ko lng po kung ano ang best way sa payment ng P.O.?
kasi may terms si supplier.. nid po bang masunod si supplier?
 
Ask ko lng po about sa receiving ng goods...

Invoice ung ibinibigay ng nag deliver na supplier.
tapos icocompare ko sya sa na approve n P.O..
then pano pag may mga charge si Supplier?

ex. endi free delivery na kasama sa Invoice.. anong way para dun??
so another table for that ?? salamat sa reply.. :)

- - - Updated - - -

Ask ko lng po kung ano ang best way sa payment ng P.O.?
kasi may terms si supplier.. nid po bang masunod si supplier?

hindi pwede magkaron ng ibang charge kung wala nakasulat sa invoice. bawal yon.

rephrase ko lang, bawal may singil na iba na wala sa OR, ang OR bago mo bayaran may invoice. so dapat meron yon sa invoice na delivery charge.
 
Last edited:
sino po may module dito ng text to pdu ? pashare naman po ... :] salamat
 
sir, panu po mgset ng modular connection? all connctions will pass from a single point which is the module, then for every use ng connection ide2tect sya kng open or close pra mgamit ulit
 
sino po may module dito ng text to pdu ? pashare naman po ... :] salamat

d2 ko nakuha pano mag convert.
http://www.developershome.com/sms/cmgrCommand3.asp

- - - Updated - - -

sir, panu po mgset ng modular connection? all connctions will pass from a single point which is the module, then for every use ng connection ide2tect sya kng open or close pra mgamit ulit

ideclare mo lang na public sa module instead sa form. pag mag add ka ng module pparang nag add ka ng form piliin mo lang module instead.
 
Back
Top Bottom