By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,742 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,742 IT Pros & Developers. It's quick & easy.

double click..

P: n/a
Pam

When I double click on a event in a form I want it to
bring up another form and load the same data so it can be
edited.

I'm having a hard time doing this. The new form loads;but
my file can't be found. Can you can me some ideas on how
to do this.

Please help!!
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi Pam,

You're not telling us much. :-(

What data? What file?

Can you show us what you're doing and tell us what does/doesn't happen?

Regards,
Fergus
Nov 20 '05 #2

P: n/a
Hello,

"Pam" <pa************@yahoo.com> schrieb:
When I double click on a event in a form I want it to
bring up another form and load the same data so it can be
edited.

I'm having a hard time doing this. The new form loads;but
my file can't be found. Can you can me some ideas on how
to do this.


What file? Please post some code.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

P: n/a
Pam
Below is a small sample of the code that loads the first
form. Once I double click on the edit part I want it to
call another form (that I have already created) and load
the event data of the same scenario that was on this first
form.
Pam
Public Function LoadScenarioForEdit(ScenarioName As
String) As Boolean
Dim filenum As Integer, strData As String, dlim As
String * 1, i As Integer
LoadScenarioForEdit = True
Me.Tag = ScenarioName
Me.Caption = ScenarioName & " - Scenario Editor"
ScenarioInfoFile = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioInfo_EXT
ScenarioEventFile = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioEvent_EXT
'Load scenario information file
filenum = FreeFile
On Error Resume Next
Open ScenarioInfoFile For Input As #filenum
Line Input #filenum, strData
Close #filenum
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then
dlim = ";"
End If
If InStr(strData, ",") <> 0 Then
dlim = ","
End If
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "No valid data delimiter for file "
& filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
End If
With dgdScenarioInfo
.AddItem strData
txtName.Text = .TextMatrix(0, 0)
txtVersion.Text = .TextMatrix(0, 1)
txtModDate.Text = .TextMatrix(0, 2)
txtHours.Text = .TextMatrix(0, 5)
txtRate.Text = .TextMatrix(0, 3)
lblRunTimeValue.Caption = .TextMatrix(0, 4)
lblSEvalue.Caption = .TextMatrix(0, 6)
lblEIvalue.Caption = .TextMatrix(0, 7)
lblREvalue.Caption = .TextMatrix(0, 8)
txtComment.Text = .TextMatrix(0, 9)
End With
End If
'Load scenario event file
dlim = " "
filenum = FreeFile
On Error Resume Next
Open ScenarioEventFile For Input As #filenum
If Err.Number <> 0 Then
strData = "Error opening file " &
ScenarioEventFile & " Error: " & Err.Number & " " &
Err.Description
WriteLog strData
MsgBox strData, vbCritical, "Edit scenario " &
ScenarioName
LoadScenarioForEdit = False
Exit Function
Else
Line Input #filenum, strData
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then dlim = ";"
If InStr(strData, ",") <> 0 Then dlim = ","
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "Unable to determine file delimiter
for file " & filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
-----Original Message-----
Hi Pam,

You're not telling us much. :-(

What data? What file?

Can you show us what you're doing and tell us what does/doesn't happen?
Regards,
Fergus
.

Nov 20 '05 #4

P: n/a
Pam
Below is a small sample of the code that loads the first
form. Once I double click on the edit part I want it to
call another form (that I have already created) and load
the event data of the same scenario that was on this first
form.
Pam
Public Function LoadScenarioForEdit(ScenarioName As
String) As Boolean
Dim filenum As Integer, strData As String, dlim As
String * 1, i As Integer
LoadScenarioForEdit = True
Me.Tag = ScenarioName
Me.Caption = ScenarioName & " - Scenario Editor"
ScenarioInfoFile = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioInfo_EXT
ScenarioEventFile = ROOT_DIR & WORK_DIR & ScenarioName
& "." & ScenarioEvent_EXT
'Load scenario information file
filenum = FreeFile
On Error Resume Next
Open ScenarioInfoFile For Input As #filenum
Line Input #filenum, strData
Close #filenum
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then
dlim = ";"
End If
If InStr(strData, ",") <> 0 Then
dlim = ","
End If
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "No valid data delimiter for file "
& filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
End If
With dgdScenarioInfo
.AddItem strData
txtName.Text = .TextMatrix(0, 0)
txtVersion.Text = .TextMatrix(0, 1)
txtModDate.Text = .TextMatrix(0, 2)
txtHours.Text = .TextMatrix(0, 5)
txtRate.Text = .TextMatrix(0, 3)
lblRunTimeValue.Caption = .TextMatrix(0, 4)
lblSEvalue.Caption = .TextMatrix(0, 6)
lblEIvalue.Caption = .TextMatrix(0, 7)
lblREvalue.Caption = .TextMatrix(0, 8)
txtComment.Text = .TextMatrix(0, 9)
End With
End If
'Load scenario event file
dlim = " "
filenum = FreeFile
On Error Resume Next
Open ScenarioEventFile For Input As #filenum
If Err.Number <> 0 Then
strData = "Error opening file " &
ScenarioEventFile & " Error: " & Err.Number & " " &
Err.Description
WriteLog strData
MsgBox strData, vbCritical, "Edit scenario " &
ScenarioName
LoadScenarioForEdit = False
Exit Function
Else
Line Input #filenum, strData
If InStr(strData, vbTab) = 0 Then 'Tab delimiter
not found
If InStr(strData, ";") <> 0 Then dlim = ";"
If InStr(strData, ",") <> 0 Then dlim = ","
If dlim = " " Then 'Unable to determine data
delimiter
MsgBox "Unable to determine file delimiter
for file " & filename, vbCritical
Else 'Convert delimiter to tab
Do
i = InStr(strData, dlim)
strData = Left(strData, i - 1) & vbTab &
Right(strData, Len(strData) - i)
Loop While InStr(strData, dlim) > 0
End If
-----Original Message-----
Hello,

"Pam" <pa************@yahoo.com> schrieb:
When I double click on a event in a form I want it to
bring up another form and load the same data so it can be edited.

I'm having a hard time doing this. The new form loads;but my file can't be found. Can you can me some ideas on how to do this.


What file? Please post some code.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
.

Nov 20 '05 #5

P: n/a
Hi Pam,

So what's actually going wrong. What's stopping you do the same thing on
the second form?

Is there something wrong in the code that you gave us? If so, any clues?
If not, what is it supposed to show us?

In other words - Please spell out the problem as if I'm an idiot. ;-)

Regards,
Fergus
Nov 20 '05 #6

P: n/a
pam
The problem in the second is isn't putting the data in the
form. I get an error saying file not found. It's not
passing the ScenarioName to the dblclick subrountine.
-----Original Message-----
Hi Pam,

So what's actually going wrong. What's stopping you do the same thing onthe second form?

Is there something wrong in the code that you gave us? If so, any clues?If not, what is it supposed to show us?

In other words - Please spell out the problem as if I'm an idiot. ;-)
Regards,
Fergus
.

Nov 20 '05 #7

P: n/a
"Pam" <pa************@yahoo.com> schrieb
Below is a small sample of the code that loads the first


Thanks for posting it twice in the same thread. :)

SCNR
--
Armin

Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.