|
You don't need the Dim portion at all if you're declaring a Static variable.
|
|
|
|
|
Dave Kreskowiak wrote: don't need the Dim
I know, but I like to try things out and see what happens. You never know what might work if you don't try.
|
|
|
|
|
The following are equivalent:
Dim Static x As Integer
Static Dim x As Integer
Static x As Integer
"Dim" just tells VB it's a variable - if any other modifier is present, VB allows you to omit the "Dim".
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Hi, dear all,
I create a variable as following
Dim xx as double
at now, it will return true if I check as following since I didn't initialize it.
if xx = Nothing then ... end if 'RETURN TRUE
But the problem is that after I initialize it to cdbl(0), it still return true while check Nothing.
xx = cdbl(0)
if xx = Nothing then ...end if ''''STILL RETURN TRUE
so how can I tell the difference for a variable initialized or not?
Thanks!
|
|
|
|
|
You can't. Not for a simple type. They're automatically initialized to zero as soon as you create them, so for a double, Cbl(0) and Nothing are the same thing.
If you're looking for an error code, or a way to ensure that it receives a value, you could just initialize it to double.NaN (NaN = Not a Number, the same result you get when dividing by zero). Then just test whether double.IsNaN(xx)
|
|
|
|
|
Ian,
Thank you very much, I will try it.
|
|
|
|
|
This is what nullable value types are commonly used for:
Dim xx As Double?
or:
Dim xx As Nullable(Of Double)
and then check if it's been assigned:
Dim isAssigned As Boolean = xx.HasValue
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Thanks, David, it's very useful.
|
|
|
|
|
Don't know where to post the Question for Crystal Report so putting it here
How to Fix/Freeze Height of Detail section in Crystal Report from within crystal report.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
modified on Wednesday, August 11, 2010 9:15 AM
|
|
|
|
|
I'm a bit confused at your question.
A detail section of a report will grow to accomodate as many records that are being printed. So how can you "fix or freeze" something like that ? If 1 record is printed is will take up less space than 1,000 records.
Can you post a more detailed explanation ?
|
|
|
|
|
Thank you so much for the post its a fixed format like an invoice/ bill which will be a single page thats why i want it as fix . From front end i can do it easily but wanna know how to do it within crystal reports.
Any how i have done it but through some other means/ways like making a sub report and fixing its height but i thought that if there would be a more better way to achieve it
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
I think you have some pre-printed pages where you want to set the details portion right place.
Increase/decrease your Page footer and Page header portion to set the details portion in its shape. That means the details portion height will be fixed from your total page height - (Page footer + Page header) width. Dont use Report header/footer portion.
|
|
|
|
|
I've created a class which Implements the INotifyPropertyChanged event and raises that event when a data member in the class is changed.
On my form, (form3), I have:
1) BindingSource
2) BingingSourceNavigator
3) DatagridView
4) Textbox boound to the "LastName" datamember of the BadgeHolder class
5) A button which sets the first occurrence of LastName in the BindingSource Datasource to "Smith"
When I click the button, the DataGridView is automatically updated with the value of Smith. Cool !
Why doesn't the Textbox get the update ?
If I move to the next record using the BindingSourceNavigator button, then I navigate back to the first record, the Textbox has the value of "Smith". Which is correct.
Why doesn't the Textbox automatically update like the DataGridView since they are both connected to the same BindingSource ?
Thanks.
Public Class BadgeHolder
Implements INotifyPropertyChanged
Public Event PropertyChanged As PropertyChangedEventHandler _
Implements INotifyPropertyChanged.PropertyChanged
{blah, blah more class stuff ...}
Public Class FORM3
Private Sub FORM3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.BadgeHolderBindingSource.DataSource = BadgeHolder.FILL
Me.DataGridView1.DataSource = Me.BadgeHolderBindingSource
Me.TextBox1.DataBindings.Add("Text", Me.BadgeHolderBindingSource.DataSource, "LastName", False, _
DataSourceUpdateMode.OnPropertyChanged)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim BHList As BindingList(Of BadgeHolder) = _
CType(BadgeHolderBindingSource.DataSource, BindingList(Of BadgeHolder))
BHList(0).LastName = "Smith"
End Sub
End Class
|
|
|
|
|
Hi All,
I need help in VB Script.
I am trying to build a customized HTA application embedded with VBscript in it.
I need to find a value from the combo box list and perform another action based on the found value.
Any help is much appreciated.
Regards
Kiran
|
|
|
|
|
The ComboBox is thoroughly explained [here].
|
|
|
|
|
Thanks all i found a way by myself
|
|
|
|
|
Okay, I just started back working on my web browser, and I want to have my custom context menu show up when the user clicks inside the browser..... This is what I have...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Tab")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
Int = Int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(UrlLocation.Text)
End Sub
That is where I suspect the bit of code will have to go... Since I'm using Tab Control instead of the WebBrowser...
Also, within the Context Menu, I am stuck on two parts...
Private Sub OpenLinkInNewWindowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenLinkInNewWindowToolStripMenuItem.Click
End Sub
Private Sub OpenLinkInNewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenLinkInNewTabToolStripMenuItem.Click
End Sub
What code would I add there to have it allow the user the option to open the Link in a new tab or a new window when they right-click over a link on the current webpage?
This is all I should need to complete my Web Browser for now.... Thanks.
|
|
|
|
|
Please somebody help me...
|
|
|
|
|
Come on people..... school starts tomorrow... I want to have this finished........
|
|
|
|
|
Hi, dear all,
I have a form with a tabcontrol which has 7 tabpages, the data for the tabcontrol will be read from database.
When the form is loaded, I only want to fill in data for the default tabpage in tabcontrol, I don't want to fill in data for all tabpages by default until user first time select that tabpage, the logic is right?
I know I can create a flag for each of the tabpage, then when user first time select that tabpage (e.g., tabpage 3), I will check the flag if data is filled in or not, if not, fill in data, set flag to true. next time when user select this page again, don't need to fill in data because data is already there.
But is there professional way to check this?
Thanks a lot!
|
|
|
|
|
Andraw Tang wrote: When the form is loaded, I only want to fill in data for the default tabpage in tabcontrol, I don't want to fill in data for all tabpages by default until user first time select that tabpage, the logic is right?
Sounds good to me - if you'd load everything on startup, the user would have to wait until all seven pages are finished loading their data. This way, you're shortening the load-time considerably.
Andraw Tang wrote: will check the flag if data is filled in or not, if not, fill in data, set flag to true
Again, sounds good to me, since you'd only want to check whether it's loaded or not. The simplest approach is often the best.
As an alternative; I'm moving to a nullable DateTime , setting it to the DateTime of the last load-moment. A few triggers on the database that keep track of the DateTime of the last change, and it's possible to see if "something" might have changed in the database.
I are Troll
|
|
|
|
|
Eddy,
Thank you for your detailed explaination.
I agree with you, the simplest way is best, since there is no existing method in vb.net to check tabpage load, I'd better use flag to indicate it.
|
|
|
|
|
You're welcome
|
|
|
|
|
All:
I'd like to write a small boot program for my main app which needs a few file properties to load additional files.
What I'd like is for the boot program to get the same info as if you were to right-click on the file and select properties in Windows Explorer.
1) The filename in the properties textbox
2) The location (filepath)
3) File modified date
I can get the filepath from using the Environment.CurrentDirectory variables, but I haven't been able to figure out how to get the filename or date. Seems like it should be something simple.
What am I overlooking?
TIA for any help.
Norm
|
|
|
|
|
I believe what you are looking for can be found in fileInfo.
Dim fi As System.IO.FileInfo
fi = New System.IO.FileInfo("<put your executable path and file name here>")
fi.LastAccessTime
See if that work for you.
david
|
|
|
|