Click here to Skip to main content
15,912,504 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Combining 3 datatables to 1 new datatable. Pin
_teh_12-Sep-08 5:10
_teh_12-Sep-08 5:10 
GeneralRe: Combining 3 datatables to 1 new datatable. Pin
Mycroft Holmes12-Sep-08 12:51
professionalMycroft Holmes12-Sep-08 12:51 
QuestionCreating Object Pin
Aman.Jen9-Sep-08 23:32
Aman.Jen9-Sep-08 23:32 
JokeRe: Creating Object Pin
Rajesh Anuhya10-Sep-08 0:17
professionalRajesh Anuhya10-Sep-08 0:17 
Questiondatagrideview with button column Pin
turkuman9-Sep-08 22:20
turkuman9-Sep-08 22:20 
AnswerRe: datagrideview with button column Pin
Rajesh Anuhya10-Sep-08 0:25
professionalRajesh Anuhya10-Sep-08 0:25 
QuestionAccessing Java script from activeX which is developed in VB6 Pin
Ravi Bhat 36509679-Sep-08 20:40
Ravi Bhat 36509679-Sep-08 20:40 
Questionproblem with collection and user control.., Please Help. Pin
Rajesh Anuhya9-Sep-08 20:27
professionalRajesh Anuhya9-Sep-08 20:27 
am developing an application using vb.net, i created a user control which used in the another application.

am passing parameters to the user control using public properties from files.

i specified a folder , when a new file is created in the folder. in the timer control code am adding the new user control dynamically if the usercontrol is not exists, if it's already exists am updation the values.

problem is when am updation the one usercontrol. the total usercontrols values are changing (as like reference), but am creating new instants every time.

Here is the code :


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Try
Dim Files As String() = Directory.GetFiles(Application.StartupPath & "\data")
Dim Filename As String
For Each Filename In Files
Dim line As String
Using sr As StreamReader = New StreamReader(Filename)
line = sr.ReadToEnd
End Using
Dim cntrllop As Integer, cntlflg As Boolean = False
For cntrllop = 1 To mycontrolcoll.Count
If (UCase(mycontrolcoll.Item(cntrllop).Name) = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))) Then
parse_data(mycontrolcoll.Item(cntrllop), line, Filename)
cntlflg = True
End If
Next
If cntlflg = False Then
SyncLock mycontrolcoll
mycontrolcoll.Add(New UserControl1, UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1)), Nothing, Nothing)
mycontrolcoll.Item(mycontrolcoll.Count).name = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))
FlowLayoutPanel1.Controls.Add(mycontrolcoll.Item(mycontrolcoll.Count))
parse_data(mycontrolcoll.Item(mycontrolcoll.Count), line, Filename)
End SyncLock
End If
'My.Computer.FileSystem.DeleteFile(Filename)
Next

Catch ex As Exception
MsgBox(ex.Message)
End Try
Timer1.Enabled = True

End Sub
Private Sub parse_data(ByRef MYcontrol As CAMR_Control.UserControl1, ByVal data As String, ByVal filename As String)
MYcontrol.Name = Mid(Split(data, ",")(0), 2)
MYcontrol.Pow_ctrlstart = True
MYcontrol.Pow_v1 = Split(data, ",")(1)
MYcontrol.Pow_v2 = Split(data, ",")(2)
MYcontrol.Pow_v3 = Split(data, ",")(3)
MYcontrol.Pow_i1 = Split(data, ",")(4)
MYcontrol.Pow_i2 = Split(data, ",")(5)
MYcontrol.Pow_i3 = Split(data, ",")(6)
MYcontrol.Pow_p1 = Split(data, ",")(7)
MYcontrol.Pow_p2 = Split(data, ",")(8)
MYcontrol.Pow_p3 = Split(data, ",")(9)
Dim fileData As FileInfo = My.Computer.FileSystem.GetFileInfo(filename)
MYcontrol.Pow_lastread = Format(fileData.LastWriteTime, "dd-MMM-yyyy HH:mm:ss")
'MYcontrol.Pow_nodenumber = Mid(Split(data, ",")(0), 2) & " ,"
MYcontrol.Pow_nodenumber = MYcontrol.Name & " ,"
MYcontrol.Refresh()
FlowLayoutPanel1.Refresh()
End Sub


Please help me ..,

Rajesh B --> A Poor Workman Blames His Tools <--

GeneralRe: problem with collection and user control.., Please Help. Pin
Rajesh Anuhya9-Sep-08 20:57
professionalRajesh Anuhya9-Sep-08 20:57 
Questioni geting hresutl exception error with crystal report with vb.net Pin
Jigneshjpatel9-Sep-08 19:18
Jigneshjpatel9-Sep-08 19:18 
AnswerRe: i geting hresutl exception error with crystal report with vb.net Pin
Dave Kreskowiak10-Sep-08 1:40
mveDave Kreskowiak10-Sep-08 1:40 
GeneralRe: i geting hresutl exception error with crystal report with vb.net Pin
Jigneshjpatel10-Sep-08 2:29
Jigneshjpatel10-Sep-08 2:29 
GeneralRe: i geting hresutl exception error with crystal report with vb.net Pin
Dave Kreskowiak10-Sep-08 7:11
mveDave Kreskowiak10-Sep-08 7:11 
QuestionEvent Problem Pin
Ballita9-Sep-08 19:06
Ballita9-Sep-08 19:06 
AnswerRe: Event Problem Pin
pdnet9-Sep-08 19:42
pdnet9-Sep-08 19:42 
AnswerRe: Event Problem Pin
Dave Kreskowiak10-Sep-08 1:40
mveDave Kreskowiak10-Sep-08 1:40 
QuestionHow to Convert LPCITEMIDLIST to a Path Pin
tjfritch9-Sep-08 9:49
tjfritch9-Sep-08 9:49 
AnswerRe: How to Convert LPCITEMIDLIST to a Path Pin
jzonthemtn10-Sep-08 2:56
jzonthemtn10-Sep-08 2:56 
GeneralRe: How to Convert LPCITEMIDLIST to a Path Pin
tjfritch10-Sep-08 3:37
tjfritch10-Sep-08 3:37 
AnswerRe: How to Convert LPCITEMIDLIST to a Path Pin
tjfritch10-Sep-08 4:54
tjfritch10-Sep-08 4:54 
QuestionConvert code from C# to VB Pin
Code1089-Sep-08 9:27
Code1089-Sep-08 9:27 
AnswerRe: Convert code from C# to VB Pin
Wendelius9-Sep-08 9:33
mentorWendelius9-Sep-08 9:33 
GeneralRe: Convert code from C# to VB Pin
Code1089-Sep-08 10:05
Code1089-Sep-08 10:05 
GeneralRe: Convert code from C# to VB Pin
Wendelius9-Sep-08 10:21
mentorWendelius9-Sep-08 10:21 
GeneralRe: Convert code from C# to VB Pin
Code1089-Sep-08 10:37
Code1089-Sep-08 10:37 

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.