|
Dim dtmDate As DateTime
dtmDate = DateTime.Now()
label1.Text = dtmDate.ToString("D")
Magesh
|
|
|
|
|
Thank you for the responses they have helped no end. Jon;)
|
|
|
|
|
Hi all,
In VB2005 I want to create an structure that some of its members should be declared with the WithEvents statement as they generate events that I'd like to handle. The compiler doesn't permit to declare members of an strcuture with WithEvents. Is there any way to do it?
thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
You'll have to use a class instead. Here is a link defining the differences. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconStructuresAndClasses.asp[^]
Although a structure's methods can handle events the method must be shared and the handler must be added using Addhandler. To quote the info in the link:
"A structure procedure can handle events only if it is a Shared (Visual Basic) Sub procedure, and only by means of the AddHandler Statement; any class procedure can handle events, using either the Handles keyword or the AddHandler statement. For more information, see Events and Event Handlers."
|
|
|
|
|
Is it possible to draw a line on design page in Windows.net
Nana
|
|
|
|
|
I don't think so. To create a line on the form you'd need to actually draw one in the paint event, which would be done during runtime. However, you could use a panel or another appropriate control set it's backcolor to black (or whatever you want) and then set it's height and width as desired to create your line.
|
|
|
|
|
Thanks for your reply.
But did it in other simpler way.
I asked my Design team to give a picture of a line.
and added it in a picture box.
Hows that?
Nana
|
|
|
|
|
Hi i have tried menubars in my form,
i got the solution........,
But now i need that menubars want to display based on the user rights...,
if he dont have rights for some menus that wont display,when he logged on in that time,
i tried that probs using some flags....,
but i didnt get solution....,
anyone plz help me......,
i need that codes........,
Regards,
Magesh
Magesh
|
|
|
|
|
not work with flags?, can you show me the code?, you systems must check the username, set flags to this users and enabled/unabled menus.
|
|
|
|
|
Hi used javascript and displayed menubars in my form..,
See each menu have submenus...,
i given for each form pageno(its the flag)...,
my ques is very critical,
take eg like..
two menus are there...,
in that two menus have 3,3 submenus..,
now one user can access in that first menu 2 forms and second menu 1 form....,
another can access in first menu 3 forms and second menu two forms...,
now how u can tell...,in that login page these are the forms menus only want to display like......,
regards,
Magesh
|
|
|
|
|
Sorry,
Are you looking for VB6 or VB.NET solution?
Sounds like you should have the access rights setup for a users group and check with IsInRole method of a WindowsPrincipal object. Is that the path you like to take?
Jelle
|
|
|
|
|
Hi i am using vb.net....,
Using javascript i displayed menubars in my form,
now i want to dispaly the menubars based on the user rights...,
If u know plz send me the code........,
Magesh
|
|
|
|
|
So VB.NET it is.
I do not understand the rest of your comments.
I would build the menu's in full form and not enable the items that an UserGroup can not use or hid the menu item altogether if that is preferred. For doing so:
You can decorate you menu creation with;
'Get a WindowsIdentity object for the current user. NameSpace: System.Security.Principal<br />
Dim currentIdentity as WindowsIdentity = WindowsIdentity.GetCurrent()<br />
'The WindowsPrincipal class can give access to the user's group memberships<br />
Dim currentPrincipal as WindowsPrincipal = New WindowsPrincipal(currentIdentity)
And use the following to test if menu items should be "not enabled" or "hidden".
if currentPrincipal.IsInRole("DOMAIN/Group Name") Then ' substitute DOMAIN and Group Name<br />
'Do your menu item setting<br />
End if
Clean up you objects. IsInRole can to with a Try block.
I hope it is something like this you are after. Else I possibly can do with some code.
Jelle
|
|
|
|
|
asp.net not work with javascript (directly), maybe you should enabled/unabled these menus with javascript and not with asp.net, this menus will be layers, with javascript activate this layers, the flags must take yours values from asp by strings or cookies and then activate the layers.
|
|
|
|
|
Create a project, add a simple class that implements System.ComponentModel.INotifyPropertyChanged, add a couple of string properties to the class. Now add a binding source to the form, and bind it to an instance of the class.
Now add text boxes and bind them to the properties of the class, also add a button.
In the Form Load event create an instance of your class and set the binding datasource to the instance of the class
In a button click event handler return the values of the databound properties by using:
ctype(Me.BindingContext(BindingSource1, "myPropertyname1").Current, String)
build and execute
DO NOT CHANGE THE VALUES IN THE TEXTBOXES
What does the code (from above)return...
For me it returns only the 1st Char of each of the bound properties!
Now alter the contents of the text box(es) and hey presto it will now return the whole string value.
Is it me?
Am i doing something wrong?
Help!
Below is some sample code for what i mean:
THE CLASS:
Public Class Fruit
Implements System.ComponentModel.INotifyPropertyChanged
Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(info))
End Sub
Private idValue As Guid = Guid.NewGuid()
Private strPlums As String
Private strApples As String
Private strPears As String
Private Sub New()
Plums = "None"
Apples = "None"
Pears = "None"
End Sub
Public Shared Function CreateNewFruit() As Fruit
Return New Fruit
End Function
Public ReadOnly Property ID() As Guid ' Psuedo key Value
Get
Return Me.idValue
End Get
End Property
Public Property Plums() As String
Get
Return Me.strPlums
End Get
Set(ByVal value As String)
Me.strPlums = value
NotifyPropertyChanged("Plums")
End Set
End Property
Public Property Apples() As String
Get
Return Me.strApples
End Get
Set(ByVal value As String)
Me.strApples = value
NotifyPropertyChanged("Apples")
End Set
End Property
Public Property Pears() As String
Get
Return Me.strPears
End Get
Set(ByVal value As String)
Me.strPears = value
NotifyPropertyChanged("Pears")
End Set
End Property
End Class
THE FORM:
Public Class Form1
Public WithEvents Fruits As Fruit
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Fruits = Fruit.CreateNewFruit
With Fruits
.Apples = "Bramley"
.Pears = "Conference"
.Plums = "Victoria"
End With
BindingSource1.DataSource = Fruits
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strNowPlums As String
Dim strNowApples As String
Dim strNowPears As String
strNowPlums = CType(Me.BindingContext(BindingSource1, "Plums").Current, String)
strNowApples = CType(Me.BindingContext(BindingSource1, "Apples").Current, String)
strNowPears = CType(Me.BindingContext(BindingSource1, "Pears").Current, String)
Label1.Text = strNowPlums
Label2.Text = strNowApples
Label3.Text = strNowPears
' The labels will show 'V', 'B', and 'C' but if you manually change the textboxes and click again it works properly!!
End Sub
End Class
|
|
|
|
|
I really happy for the respond.Thanks and God bless.
Demola.
|
|
|
|
|
|
i want to attach a flash file in vb.net form. i hav followed the folling procedure
first added shockwave object then
Place the Flash MX file in bin folder of the project.
Now double click on the form and write code on form load event
Button1.Text = "Play"
double click on the button and wrilte the following code on the Button1_Click event
AxShockwaveFlash1.Stop()
AxShockwaveFlash1.Movie = Application.StartupPath & "\segment1.swf"
AxShockwaveFlash1.Play()
this code is not working,plz tel me exact code
|
|
|
|
|
' TableName.RelationName.ColumnName string.
TextBox1.DataBindings.Add("Text", ds, "A.a_to_b.ColName")
I do understand the binding cenario above where a parent
table points out child records.
But I want to bind the other way around!
ds.Relations.Add("A_to_B", _
ds.Tables("A").Columns("ID"), _
ds.Tables("B").Columns("A_ID"))
BindingContext(ds.Tables("B")).Position
TextBox1.DataBindings.Add("Text", ds, "B.a_to_b.ColName")
Is this not possible?
Johan Svensson
|
|
|
|
|
I have a form for which I have changed the Appearance properties such as
BackColor : White (Palette)
FillColor : Black (Palette)
ForeColor : Black (Palette)
I have a 'Ok' command button on the form. I want the command button to be White with black font on it. For that I made the following changes
BackColor : White (Palette)
MaskColor : White (Palette)
But it still shows the button as windows color (grey). Is there some way to make it white or transparent atleast?
Can anyone please tell me what am I missing out to make the command button appear white with black 'Ok' on it.
|
|
|
|
|
hi folks!
I am developinng Window application with VWD Express. I have a database with this window application.
What I am trying to do is save information to the database of the application (thru code-behind). However, when I am connecting to database, I realize that I need ConnectionString. In Web application, connection string is determined in web.config. How we determine connection string in window application?
Many many thanks in advanced for the help and time!!!
www.thesemplice.com
|
|
|
|
|
I am sorry, I meant to say that I developed the application with Visual Basic Express Edition.
Thanks!
www.thesemplice.com
|
|
|
|
|
thesemplice wrote: In Web application, connection string is determined in web.config. How we determine connection string in window application?
Well, the IDE guides you to use web.config - there is no requirement to use that.
In a windows application, I'd suggest the app.config.
|
|
|
|
|
|
Thanks for all the replies. Colin was right, it is in the app.config.
Dave also reminded me about ConnectionStrings.com. I just thought about it and will look at it.
Thanks all!
www.thesemplice.com
|
|
|
|