|
Why couldn't you do something like this...
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Load_DD(m_dd1, "SELECT * FROM CUSTOMER", "Customer_Name", "Customer_ID")
Load_DD(m_dd2, "SELECT * FROM PRODUCT", "Product_Name", "Product_ID")
etc...
End If
End Sub
Private Sub Load_DD(ByVal MyDropDown, ByVal MyQuery, ByVal MyText, ByVal MyField)
Dim ErrorMessage As String
Dim ds As DataSet
Try
ds = A_DB_Function_That_Returns_A_DataSet(MyQuery)
MyDropDown.DataSource = ds
MyDropDown.DataTextField = MyText
MyDropDown.DataValueField = MyField
MyDropDown.DataBind()
Catch ex As Exception
ErrorMessage = ex.Message
Finally
End Try
End Sub
|
|
|
|
|
Have you done ANYTHING yourself about this? I mean actually CODED or RESEARCHED the problem? Even READING the help files would be a great start. My advice to you is RTFM. Don't expect us to provide answers to your URGENT problem. Give us a break.
...Steve
|
|
|
|
|
Hi,
How can i arrange controls at desitrd locations while i am creating controls at run time.
i have given X,Y coordinates for position, and i set Docked property to Top.
i creating controls in a loop, Each control irrespective of their location coordninates control is adding at the top of the form. i have to position the control according to given location values.
Please help me out.
|
|
|
|
|
If you want to set the X,Y location of a control, you have to set it's Dock property to None. Since your setting it to top, it's doing exactly what it's told. Ignoring the location property and attaching itsefl to the top of the container, in your case - the form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
if i set Dockedproperty to none all controls are coming one behind the other.
|
|
|
|
|
Just set their Location.X and Location.Y properties and add them to whatever container your putting them in.
Dim myButton As New Button
myButton.Location = New Point(X, Y)
Me.Controls.Add(myButton)
Just be sure your not using the same X and Y values for the location.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
p'' This is my code,
''y position is not same for all the controls.
Dim y As Integer = 0
If Dv_Tag.Tables(0).Rows.Count > 0 Then
For i As Int16 = 0 To Dv_Tag.Tables(0).Rows.Count - 1
CheckBox1 = New CheckBox
AddHandler CheckBox1.Click, AddressOf CheckBox1_Click
CheckBox1.Size = New System.Drawing.Size(150, 24)
CheckBox1.Location = New System.Drawing.Point(25, y + 28)
CheckBox1.SetBounds(25, y + 28, 150, 24)
Me.Controls.Add(CheckBox1)
Next
End If
End Sub
|
|
|
|
|
pavani123 wrote:
For i As Int16 = 0 To Dv_Tag.Tables(0).Rows.Count - 1
CheckBox1 = New CheckBox
AddHandler CheckBox1.Click, AddressOf CheckBox1_Click
CheckBox1.Size = New System.Drawing.Size(150, 24)
CheckBox1.Location = New System.Drawing.Point(25, y + 28)
CheckBox1.SetBounds(25, y + 28, 150, 24)
Me.Controls.Add(CheckBox1)
Next
pavani123 wrote:
y position is not same for all the controls.
Where are you changing the value of y in this loop? Every iteration of this loop uses the exact same value of Y because you never change it. You might want to change your code a bit to do this.
For i As Int16 = 0 To Dv_Tag.Tables(0).Rows.Count - 1
CheckBox1 = New CheckBox
AddHandler CheckBox1.Click, AddressOf CheckBox1_Click
CheckBox1.Size = New System.Drawing.Size(150, 24)
y+=28
CheckBox1.Location = New System.Drawing.Point(25, y)
CheckBox1.SetBounds(25, y, 150, 24)
Me.Controls.Add(CheckBox1)
Next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Thanks, i did't catch this small thing.
Thanks alot.
|
|
|
|
|
in a rich Textbox i wanna show some words as link (for example when u write www.codeproject.com , u see a web link ) but I wanna do the same for some words. After that I have to catch , this link whether is clicked or not.
How can I do ?
|
|
|
|
|
you can write like this.
Text here...
I think thats it.
Regards,
Asim
|
|
|
|
|
Some Queries i need answers for this queries
that will support 4 sql server
Note: all of this are done using a single query.
1. how to find the desired maximum of a column ,1st,2nd..etc.,
2. display the middle row of a table if 7 rows then we should show 4th is the middle
3. how to display the last day of the month
V.Gopi.
Easy Design Systems
Coimbatore
India
|
|
|
|
|
I want to enable TCP\IP protocol for sqlserver, for my client server application, at server side. Becoz i m using MSDE as database. I can enable it through by using SvrNetcn.exe, but want to enable it by vb.net code or by command line or any other way with out using any User Interface. How i can do that?
SEC
|
|
|
|
|
Hi I am trying to update record using this syntax,
SqlStr = "Update table1 SET table1.column_name =" & texbox.Text"
The problem is in the textbox, there is a quote in the middle of the string (') which VB cannot read. How do I convert that quote so that the vb can read the the sql string.
dw1928
|
|
|
|
|
when passing the string try this
texbox.Text.Replace("'","''") <---
Dont worry it will store singe (') in the Database
_mubashir
|
|
|
|
|
VB can read the string without any problem. The real issue is that the method your using to build the SQL query isn't tolerant of characters that will create an invalid SQL statement. You'd be much better off building this as a parameterized query. You can read about what they are and why you should be using them in an article by Colin Angus Mackay, SQL Injection Attacks and Some Tips on How to Prevent Them[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All,
Do any one know how to display a video clip in the form itself and not run it separately using VB .NET?
Please advice
Thanks
Best Regards
Tim Yong
|
|
|
|
|
The simplest way to do this would be to add the "Windows Media Player" to your ToolBox, then drag and drop the control onto your form. You could then set it up to drop the user interface and then just tell it which file to play.
Player.uiMode[^] from the Windows Media Player 10 SDK docs.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
'first of all you have to import a called QuartzTypeLib
'declear globle variables
Dim bAudio As IBasicAudio
Dim bvideo As IBasicVideo
Dim mEvent As IMediaEvent
Dim vdoWindow As IVideoWindow
Dim mCtrl As IMediaControl
Dim mpos As IMediaPosition
Public Const WS_VISIBLE = &H10000000
'call remove media to remove oldloded media
********************************************************
Public Sub RemoveMedia()
Try
DisableCtrl()
If Not mCtrl Is Nothing Then
mCtrl.Stop()
End If
If Not vdoWindow Is Nothing Then
'vdoWindow.Owner = Nothing
End If
If Not bAudio Is Nothing Then
bAudio = Nothing
End If
If Not bvideo Is Nothing Then
bvideo = Nothing
End If
If Not mCtrl Is Nothing Then
mCtrl = Nothing
End If
If Not vdoWindow Is Nothing Then
vdoWindow = Nothing
End If
If Not mpos Is Nothing Then
mpos = Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
*********************************************************
call loadMedia to load new media file to be plaed prove file name and path as string in the function
**********************************************************
Public Sub LoadMedia(ByVal data As String)
On Error GoTo OpenFileError
mCtrl = New FilgraphManager
Call mCtrl.RenderFile(data)
bAudio = mCtrl
bAudio.Volume = 0 'Loudest
bAudio.Balance = 0 'Centered
bvideo = mCtrl
vdoWindow = mCtrl
vdoWindow.WindowStyle = WS_VISIBLE 'WS_VISIBLE = &H10000000
vdoWindow.Top = 0
vdoWindow.Left = 0
vdoWindow.Width = mainWindow.Width
vdoWindow.Height = mainWindow.Height
vdoWindow.Owner = mainWindow.Handle.ToInt64
mEvent = mCtrl
mpos = mCtrl
mpos.Rate = 1 'Normal forward playback speed
Me.panMedia.Text = "File Loaded"
PosBar.Maximum = mpos.Duration
EnableCtrl()
SetTotalTime()
Exit Sub
OpenFileError:
Err.Clear()
Resume Next
End Sub
********************************************************
user myCtrl.Play(),myCtrl.Stop(),myCtrl.Pause() to play stop and pause.and take only picture box as the window to play the file here "mainWindow" variable is the nmae of the picture box.:cool:
Get back 2 me
|
|
|
|
|
Hello all,
I am stuck wih a problem. I have created Splash Screen(Form1) after a interval of time (Using Timer) I nee to show Login Form (Form2).
I used this code to show form 2 but This is not working
Pivate sub Timer1_Tick(byval sender as <blabla>, byval e as <balbla>)<blabla>
If Timer1.Interval = 100 then
Dim f as new form2
f.showDialog
End if
End sub
but this is not working. It will show the Form2 but it wont close the form1
So can any one slve this problem
I even tried f.show, f.hide it will close the whole application. I want the Form2 to be active.
Waiting for your reply...
Cheer's
Santhosh
santhosh nataraj
|
|
|
|
|
hi there,
just simply close the form1 before showing form2
<< >>
|
|
|
|
|
Can't do that. Since Form1 is his startup form, it'll close his entire application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Search the articles here for Splash Screen. YOu'll come up with lots of examples on how to do it.
Basically, you can't make a splash screen your startup form. Closing it will close your entire application since you just shutdown your app's message pump. What you can do is launch two applications, the first being the Splash form and the second being your main form for your application. You'll see what I mean in the examples you find.
Now, for you login screen. You're main form has to check to see if it's login user ID and have been authenticated by whatever means your using. If not, your main form then puts up a login form that authenticates the user's credentials. Once the login form returns contorl to the main form, your main form then checks again to see if the login was sucessfull, and if so, just continues on it's way. If not, that's up to you. You can put up a warning that the user has limited functionality, or you could just quit, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello All!
I have a problem regarding desktop application in vb.net...
Actually I have a formA that hasa a textbox...such that when the textbox gets the focus It calls FormB......
Problem is that when the formB is closed It gets the focus back to the textbox on FormA which in turns call FornB and so on...
i am making the FormB Model...
So my question is that is there any possibility that from FormB I can set the focus to any other control on FormA.......
It is to be noted that i am not closing FormA...
Thanx in Advance!
_mubashir
|
|
|
|
|
The problem is that you cannot set focus to a control that is not active and since FormA is not active at the time FormB is about to close (where you would want to set focus to another control on FormA) it can't be done. You'd also need to expose FormA's controls etc. to FormB to go down this path anyway and that is not a best practice.
What I suggest is that you set a global (to FormA) variable in the textbox's GotFocus() event before you show FormB and you conditionally show FormB only when this variable is False. This will prevent the infinite loop.
...Steve
|
|
|
|