|
I got it : )
changed it to:
If ddlCT1 Is "" Then
Now it functions perfectly.
|
|
|
|
|
It is preferred to have the code in one place, as it makes stuff easier to locate.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have a FlexGrid control in which i make data entry and when i click on save command button it saves that data to a sequential file. Now my problem is that in another form, I want the user to edit any cell in the FlexGrid and that entry must replace the corresponding entry in the sequential file. But it is appending in the file, inspite of replacing the value that is edited.
|
|
|
|
|
Sequential files are tricky: they are called sequential because you cannot change the contents in an aribitrary location in the file.
The only solution using sequential files is to
1) create a new temporary file (in Output so you don't accidentally append to an existing file)
2) append the old data into the new file until you reach the point which the changed data
3) write the new data
4) resume appending the remaining data (take care to skip the changed ones before resuming copy)
The other solution requires you to use Random Access Files and to devise another way of memorizing the data.
Geek code v 3.12
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++*
Weapons extension: ma- k++ F+2 X
|
|
|
|
|
|
Hello !
Is possible to use a global variable in a class like this :
Module Module1
....
Public v1 as integer
....
End Module
......
Public Class cl1
....
Public ReadOnly Property quantity As Integer
Get
return v1+.....-....... - So some calculations that use v1
End Get
End Property
....
End class
Is this possible ?
Thank you !
|
|
|
|
|
Yes it is possible if the variable is in a module - but it is not a good idea.
(Read up on race conditions for why)
|
|
|
|
|
I need a way to show a date with the difference between local time and GMT (Zulu) using VB 6.
The format has to be cccc-mm-dd hh.mm:ss +-hh.mmZ
For example, here in AZ we are GMT - 7.00 so 9:00 am would be 2015-09-16 09.00.00 -7.00Z
Does anyone know how I can do this?
Thanks.
Murray
|
|
|
|
|
Better put on your asbestos suit. VB 6 is not well liked around here.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Well, I like it and use it I'll devise an answer in the meantime.
Geek code v 3.12
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++*
Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I know, I know.
It's a mystery to me that people get so het up about what tool they like.
As if anyone really cares.
Every language I know and use has good and bad features.
Our job as programmers is to choose the best fit to the current task-and if that task is maintaining VB 6 code then ...
Murray
|
|
|
|
|
I have found a module to this address http://www.vbrad.com/article.aspx?id=62[^] which finely solves the time zones problems, I use this in production code daily (it has been used in my company for years).
I hope that helps you too.
Geek code v 3.12
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++*
Weapons extension: ma- k++ F+2 X
|
|
|
|
|
And, despite the people that decry VB6, it IS still used in many organizations and STILL needs to be maintained.
Can it be rewritten in a newer language? Yes.
Is there a cost? Yes.
Is there justification. Not always.
Ask the financial industry how many applications are still written in COBOL and why...
|
|
|
|
|
That solved my problem!!
Many thanks.
Murray
|
|
|
|
|
Hello
I am new to this platform and my hope is I do that at right place. I had found Mark Regal's ,article named Deconstruction of a VBA Code Module. I am facing trouble making it work.
I have an MS-Access 2002 application which I want to parse my applocation's by code using provided module by Mark. According to the usage instructions to run it the IDE should be a later version then 2002 to support the functionality. Therefore I opened that Access 2002 MDB file on MS-Access 2010 and had imported his module into my project.
Now I stacked and I can't make it work. do I miss anything? Is the code exclusive to be used with MS-Excel?
Can anyone provide me the steps to make this work?
Thanks for any provided answer.
ruvain
|
|
|
|
|
I suggest you ask your question on the article page itself. The author is the most likely person to answer your questions, and it is much more likely he will see your question if you ask it there.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Hi, i have used VB6Flexgrid1 (activex control) developed by Mostafa Kaisoun in my project to enter data. Now my problem is, i want to restrict number of columns and rows (like rows=3 and columns=2) but when i enter the last record in cell(3,3), it adds new row to the grid which i donot want. so plz tell me how to restrict it to the desired rows and columns only.
|
|
|
|
|
Have you tried asking Mostafa Kaisoun?
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
More generally: I saw that the original MS Flexgrid control (which I assume is the parent of VB6FlexGrid1) has a event named RowColChange that, as the Change event is usually managed in VB, is triggered BEFORE the selection fo the new cell. I think you can trap that event, check if the new Row,Col is inside your range and if not manually set the new Row,Col (to the previously selected one, for example).
I hope to have been of aid,
Denis
Geek code v 3.12
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++*
Weapons extension: ma- k++ F+2 X
|
|
|
|
|
|
I'm using entity framework.
I have generated the model.edmx with a wizard process.
For an entity , Myobj1 I have added a not-mapped property :
Partial Public Class Myobj1
<NotMapped> Public Property sumvalue As Decimal
End Class
Now I have this query :
Dim lst = (From t In context.MyObj1 _
where t1.id>6 Select New With { _
.Parent = t, _
.sash = t.child1.Where(Function(t2) t2.tp=2) _
.Select(Function(t3) t3.quantity), _
.DefaultIfEmpty().Sum(), _
}).ToList
I want that instead of .sash , to put the sum value into the not-mapped property .sumvalue.
Is this possible to do this in my query, and if yes , how can I do ?
Thank you !
|
|
|
|
|
Hello !
I'm using Entity framework. I have this scenario :
ParentObject - has a child collection : Child1.
On the Form I have 1 checkbox and 1 button. I have a report that display the PArentObject and the corresponding list of Child1.
the Onclick's event of the button has this code :
context.Configuration.LazyLoadingEnabled = False
Dim plist as IQueryable(Of ParentObject)
Dim chlist as IQueryable(of Child1)
plist=context.Set(Of ParentObject)
chlist=context.Set(of Child1)
plist.ToList()
chlist=chlist.Where(Function(t1) plist.Any(Function(t2) t2.id=t1.parent))
If checkbox1.checked then chlist=chlist.Where(Function(t1) t1.vl>0)
chlist.ToList()
MyReport.Datasource=plist.ToList
These are the result when I press the button :
1) With checkbox checked , Press the button ( first time ) - The report display all the Parent , each of them with only the childs that have vl1>0 ( **Correct** )
2) With checkbox unchecked , press the button (second time ) - The report display all the Parent with all the childs ( **Correct** )
3) With checkbox checked , press the button ( third time ) - The report display all the parent with all the childs ( **Not correct** )
I close the form , and re-open it
1) With checkbox unchecked , press the button (First time ) - The report display all the Parent with all the childs ( **Correct** )
2) With checkbox checked , press the button ( Second time ) - The report display all the parent with all the childs ( **Not correct** )
Why I get not correct results when repeating the queries like in the examples above ? What should I do in these cases ?
Thank you !
|
|
|
|
|
I have a windows form with code in VB 2010, developed with VS 2010. I upgraded it from an earlier VB version. There is a message box in a procedure that runs with a button click. But this message box shows on form load before the form is visible. If I remove the message box, the form loads as expected. What can be wrong?
Bobby
|
|
|
|
|
BobbyStrain wrote: What can be wrong? Anything at all. But you need to show the code that has the problem if we are to help you.
|
|
|
|
|
Here is the form load and button click code. Only relevant code shown on button click.
Private Sub HoSepForm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
'Plug in default values when the form loads
txtVaporViscosity.Text = CStr(0.01)
txtLiquidViscosity.Text = 0.5
ddlVesselConfig.SelectedIndex = 0
ddlVesselTypes.SelectedIndex = 0
spnLiquidSurge.Value = 10
txtDesignPressure.Text = CStr(250)
cmdKOType.Text = "Process Separator"
cmdConfig.Text = "1 Inlet & 1 Outlet"
cmdMaterial.Text = "CS"
cmdDiameterIncrease.Visible = False
cmdDiameterDecrease.Visible = False
txtVaporFlow.Text = 300000
txtLiquidFlow.Text = 100000
txtVaporDensity.Text = 0.5
txtLiquidDensity.Text = 50
txtTemperature.Text = 110
txtOperatingPressure.Text = 200
txtWaterFlow.Text = 10000
ckDemister.Checked = False
lstDropSize.SelectedIndex = 0
ddlDemister_h.SelectedIndex = 0
ddlDemister_h.Visible = False
ddlDemisterDim.Visible = False
Label23.Visible = False
End Sub
Sub cmdSize_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSize.Click
(dim and some code)
'Capture all the input parameters & values
SepType = cmdKOType.Text
Material = cmdMaterial.Text
DesignPressure = Val(txtDesignPressure.Text)
VaporMassFlow = Val(txtVaporFlow.Text)
LiquidMassFlow = Val(txtLiquidFlow.Text)
VaporDensity = Val(txtVaporDensity.Text)
LiquidDensity = Val(txtLiquidDensity.Text)
VaporVisc = Val(txtVaporViscosity.Text)
'LiquidVis = Val(txtLiquidViscosity.Text)
DropSize = Val(lstDropSize.Text)
HoldTime = Val(lblLiquidSurge.Text)
OpTemperature = Val(txtTemperature.Text)
WaterRate = Val(txtWaterFlow.Text)
'Validate that the input is complete
If VaporDensity * LiquidDensity * VaporVisc * DropSize > 0 Then
'Input complete, so calculate drop settling velocity
DropSpeed = Calculate_Drop_V(DropSize, VaporDensity, LiquidDensity, VaporVisc)
'Then stick it in the output label on the form
lblDropSpeed.Text = CStr(System.Math.Round(DropSpeed, 2))
'Calculate vapor/liquid volumetric flow & holdup volume
CFSV = VaporMassFlow / VaporDensity / 3600
CFSL = LiquidMassFlow / LiquidDensity / 3600
'LVol = CFSL * 60 * HoldTime
waterdensity = Water_Density(OpTemperature)
WaterVol = WaterRate / waterdensity / 60
LVol = ((CFSL * 60) + WaterVol) * HoldTime
watervisc = Water_Vis(OpTemperature)
totalliquid = CFSL * 60 + WaterVol
totalliquiddensity = (LiquidMassFlow + WaterRate) / totalliquid / 60
lblWaterDensity.Text = CStr(Math.Round(waterdensity, 2))
lblWaterViscosity.Text = CStr(Math.Round(watervisc, 2))
'If the input is incomplete, then exit the form, alerting the user.
Else
-> this is msgbox that shows before form is visible MsgBox("Input not complete")
Exit Sub
End If
(more code)
|
|
|
|