|
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
|
|
|
|
|
Thanx Steve.... I have already done this as you said by setting the global variable........
But I was thinking may be this can happen....
Anyways......Thanx
_mubashir
|
|
|
|
|
can anyone help me to implement a genetic algorithm to solve the TSP for tours of length 20, 50 and 100 using one of chromosome recombination and mutation operators in VB.need help....
|
|
|
|
|
|
|
I am working on a custom GroupBox control (called GroupCheckBox) that has a checkbox for enabling and disbling the child controls it contains. The way I have my GroupCheckBox control setup is by using a combination of controls. It inherits from the GroupBox control, and a CheckBox control exists within it. I am trying to create two properties on the GroupCheckBox control to handle Checked and CheckState properties similar to the CheckBox control. These properties look like so in VB code:
<br />
Public Class GroupCheckBox<br />
Inherits System.Windows.Forms.GroupBox<br />
<br />
Friend WithEvents checkBox As System.Windows.Forms.CheckBox<br />
'omitted irrelevant code...<br />
<Category("Appearance")> _<br />
Public Property Checked() As Boolean<br />
Get<br />
Return Me.checkBox.Checked<br />
End Get<br />
Set(ByVal Value As Boolean)<br />
EnableGroup(Value)<br />
Me.checkBox.Checked = Value <br />
End Set<br />
End Property<br />
<br />
<Browsable(True), EditorBrowsable(EditorBrowsableState.Always), Category("Appearance")> _<br />
Public Property CheckState() As CheckState<br />
Get<br />
Return Me.checkBox.CheckState<br />
End Get<br />
Set(ByVal Value As CheckState)<br />
Me.checkBox.CheckState = Value <br />
End Set<br />
End Property<br />
<br />
End Class<br />
Unfortunately, whenever I change one of the properties, like let's say I change Checked to false, the CheckState property is not in synch with it and doesn't change in the design view. This doesn't happen when you use a CheckBox control, the two properties are in synch and match their values accordingly. I think the problem lies within the form designer not being updated in my code. Is there some way to tell the form designer to update the other property when it's corresponding value is changed? I'm guessing this can be done by using something within either the System.ComponentModel or System.ComponentModel.Design namespaces. BTW, I am using VB.NET on Visual Studio .NET 2003.
|
|
|
|
|
does anybody have the vaguest idea why this gives a runtime system error?
<br />
imports System<br />
Imports Microsoft.Win32<br />
Imports System.Data<br />
Imports System.Data.SqlTypes<br />
imports System.Data.Odbc<br />
<br />
dim DBConnection as new OdbcConnection("DSN=XYZ")<br />
DBConnection.Open()<br />
and yes there is a system dsn called XYZ that works from the odbc control panel thingy
thnx
:/
"there is no spoon" biz stuff about me
|
|
|
|
|
Try wrapping the code in a Try..Catch block and inspect the exception message directly. It may be that your DSN connection is attempting to use a trusted connection when one does not exist so you may need to provide more parameters in the connection string.
Try
Dim DBConnection As New OdbcConnection("DSN=XYZ")
DBConnection.Open()
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
...Steve
-- modified at 20:36 Thursday 22nd September, 2005
|
|
|
|
|
does anybody know how to enumerate the available odbc connections from a vb.net app? i cant find any docs on it in msdn
thnx
"there is no spoon" biz stuff about me
|
|
|
|
|
I don't know how to do this in managed code. The only way I know how to do it is to use the old ODBC API. The function SQLDataSources() should do the trick.
MSDN information[^]
I found an example how to use it in VB.Net.
http://www.vbcity.com/forums/faq.asp?fid=8&cat=General#TID1391[^]
I hope this helps.
-- modified at 16:50 Thursday 22nd September, 2005
<edit>
Actually, that code example that I linked above looks more like VB6. Sorry about that, but I'm sure it'll give you the idea.
|
|
|
|
|
thnx a lot joshua ... i think the example was in vb6 and i dont know enough of .net to convert all the external ref calls yet so i went with reading the registry directly *clunk clunk*
<br />
dim rk as RegistryKey = registry.LocalMachine.OpenSubKey("Software")<br />
rk = rk.OpenSubKey("ODBC")<br />
rk = rk.OpenSubKey("ODBC.INI")<br />
rk = rk.OpenSubKey("ODBC Data Sources")<br />
dim names as String() = rk.GetValueNames()<br />
*sigh* vb is _so_ elegant no?
"there is no spoon" biz stuff about me
|
|
|
|
|
I don't know if there is a better way to do this in VB.NET.
There are registry keys that contain ODBC info of various and sundry sorts, in Win 2K:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources
and identical keys unders the various HKEY_USERS nodes
Also
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI
In VB6 you could use a COM dll named "ODBCTool.dll" to enumerate all ODBC drivers installed, enumerate all DSN connections configured, and create a new DSN connection.
Not sure if MS provides the inter-ops for this DLL for NET.
|
|
|
|
|