|
This[^] should get you started...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello every body. can you tell me a hyperlink that show more detail about textbox's event.
|
|
|
|
|
|
how the function replace work.
for example the statement below...
strSource = Replace(strSource, """", "|")
angela
|
|
|
|
|
It creates a new string where the strings are replaced.
Example:
strSource = "asdf"<br />
strDest = Replace(strSource "sd", "-")
Now strDest contains "a-f"
---
b { font-weight: normal; }
|
|
|
|
|
ok, thanks al lot
angela
|
|
|
|
|
I need to read user and organization data from Active Directory , and then insert the data into SQL Server.
Is there any sample code or web site for me?
Thanks a lot!!
|
|
|
|
|
search for "LDAP", also at the ms knowledge base
|
|
|
|
|
I have a small VB 2005 app that opens an instance of PowerPoint, opens a presentation, selects a slide (Variable sld as Slide) and then does a sld.copy() to put a copy of the slide on the clipboard. I know the clipboard has the slide, I can use Paint to see it. What I want to do get the bitmap off of the clipboard and into a PictureBox control, but I have had NO luck. I've found many ideas from MSDN, etc. but none seem to work. Why is this difficult to do? Help would be appreciated.
Some code I've tried to confirm there is an image... along with usng Paint to open the image that I copied using the sld.Copy() program code...
Dim myDataObject As New DataObject(DataFormats.Bitmap, My.Computer.Clipboard.GetImage)
Dim arrayOfFormats As String() = myDataObject.GetFormats()
TextBox1.Text = "The format(s) associated with the data are: " & ControlChars.Cr
Dim i As Integer
For i = 0 To arrayOfFormats.Length - 1
TextBox1.Text += arrayOfFormats(i) & Chr(12) & Chr(10)
Next i
The above code returns:
The format(s) associated with the data are:
System.Drawing.Bitmap
Bitmap
Which implies that the data is able to be interpretted somehow...
And I can also use...
Dim bool As Boolean
bool = myDataObject.ContainsImage
Returns TRUE... So there is an image...
bool = myDataObject.GetDataPresent("System.Drawing.Bitmap")
Returns TRUE... So there is an image...
But all kinds of code DOES NOT result in an image either as various objects or one that I can use in my PictureBox.
Thanks in advance. I hope I can help someone here too, but I am a novice bascially.
|
|
|
|
|
MarchJ,
Items from PowerPoint are placed on the clipboard as an "Enhanced" Metafile Format Image, not a bitmap. You can open them in paint because it can automaticaly open an enhanced metafile (one of the reasons paint is still around).
The only way I know to retrieve the enhanced metafile from the clipboard is to still use the windows API clipboard functions.
This should work in VB2003, and VB2005.
'--- Class --------------------------------------------------
Imports System.Runtime.InteropServices
Public Class ClipboardAPI
<DllImport("user32.dll", EntryPoint:="OpenClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="EmptyClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EmptyClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="SetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetClipboardData(ByVal uFormat As Integer, ByVal hWnd As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="CloseClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function CloseClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="GetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetClipboardData(ByVal uFormat As Integer) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="IsClipboardFormatAvailable", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function IsClipboardFormatAvailable(ByVal uFormat As Integer) As Short
End Function
End Class
'--------------------------------------------------------
'------- Form code --------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const CF_ENHMETAFILE As Integer = 14
Dim hEnMetaFile As IntPtr
Dim metafile As System.Drawing.Imaging.Metafile
If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETAFILE) <> 0 Then
henmetafile = ClipboardAPI.GetClipboardData(CF_ENHMETAFILE)
metafile = New System.Drawing.Imaging.Metafile(hEnMetaFile, True)
ClipboardAPI.CloseClipboard()
PictureBox1.Image = metafile
End If
End If
End Sub
'----------------------------------------------------------------------
Hope that helps.
progload
|
|
|
|
|
Thanks for the help... I'll give that a try. But now I wonder why a function call I used to determine the format of the data on the clipboard reported that the file was a Bitmap... Anyway, I really appreciate the help and I'll try your solution ASAP tomorrow.
One day I hope I can help someone too!
|
|
|
|
|
The proposed solution didn't work. I'll post a more detailed code fragment at a later date.
Thanks.
|
|
|
|
|
Hi ,
Please i want to ask you if you can tell me how to do a complete deployement to ma application i've got a lot of courses but noone is good enough to tell me all what i have to do to get a correct installation file
well , i wanna know how to integrate the .NetFramwork to ma app. like that if it doesn't find it installed in the target computer it will lunch the installation imediatley like that ma app will be run in all PCs
i hope you understood what i meant please help me finish that stuff i'm working on it for 15 days or may be more
thank you
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: well , i wanna know how to integrate the .NetFramwork to ma app. like that if it doesn't find it installed in the target computer it will lunch the installation imediatley like that ma app will be run in all PCs
http://www.codeproject.com/dotnet/dotNetInstaller.asp[^]
Mohammed Amine wrote: Hi ,
Please i want to ask you if you can tell me how to do a complete deployement to ma application i've got a lot of courses but noone is good enough to tell me all what i have to do to get a correct installation file
http://support.microsoft.com/kb/821766/en-us[^]
|
|
|
|
|
I am not sure i got the english right; but assuming you want your application to detect if the client computer has no .net framework, then it should proceed to install it.
this is the default action of .net application so it should automatically happen, unless it was you changed your settings. You can still ensure it happens following this procedure:
VB/VC#: Project Properties > Publish tab > Prerequisites. make sure the .NET Framework check box is ticked.
|
|
|
|
|
Hi ,
I'm using a Crystal report in ma app. to print some data & i found a good course that walk step by step discribing how to add crystal report to your app.
everything is going alright except that "Field Explorer" i don't find it .
i'm using vs2003 i don't know what version of crystal report
can you help me by telling me where can i find that "Field Explorer" ?? this will help me a lot
thank you very much
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: I'm using a Crystal report in ma app. to print some data & i found a good course that walk step by step discribing how to add crystal report to your app.
Your should provide the resource that you found for us.
Mohammed Amine wrote: everything is going alright except that "Field Explorer" i don't find it .
What is "Field Explorer"? Is it the name of the field that demonstrate in the course that you have?
|
|
|
|
|
If you right click on your report a menu will popup that includes a toggle for the field explorer. Mine appears docked on the left hand side of my screen with the server explorer and toolbox. And yeah...where did you find that walkthrough, because I'm just starting to work with Crystal Reports right now and I'd appreciate any help I could get.
-- modified at 9:23 Tuesday 13th June, 2006
The Field Explorer toggle is also in the Crystal Reports menu that appears in the file menu....I think these will only appear if you are in the design mode of the actual report.
|
|
|
|
|
i already found it , thank you very much
bue i want to know something else can you help me in ?
well now i included the CR in ma project all what i have to do now is displaying information in the reportview but i don't know the way how to display this informations
i'm using a typed dataset wich i added two tables reserver & reservation & i binded them with a relashion , now i wanna display on that report ;
num_reserver : num_reser
nom_reserver : nom_reser
....
and here i want to show all the reservation of this reserver in a grid or something
i hope you understood me
thanks for helping
try to be good if you can't be the best
|
|
|
|
|
Here is how I have displayed crystal reports to the user. I use a Crystal Reports Viewer control from the toolbox. A ReportDocument control from the toolbox (and type it to my crystal report file with the extension .rpt...when you drag it onto the from a popup will ask you about typing). Now in code it will look something like this:
'Set the DataSource to your ReportDocument control
objReportDocument.SetDataSource(dsMyDataSet)
'Set report parameters (if you use them)
objReportDocument.SetParameterValue(0, strMyParmValue)
'Set the ReportSource to your CrystalReportViewer control
crvMyCrystalReportsViewer.ReportSource = objReportDocument
|
|
|
|
|
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
this is the line that caused the issue
Line 32: UserInfo.GetUserName()
The above error I'm recieving when calling a function that is in a user control called UserInfo and this is the code from it.
Public Sub GetUserName()
' Get the user name
Dim ntUserName As String = Me.Request.ServerVariables("AUTH_USER")
userName.Text = ntUserName.Substring(ntUserName.IndexOf("\") + 1)
End Sub
Any Help would be appreciated!
|
|
|
|
|
|
Thanks that did the trick appreciate your help
Mike
|
|
|
|
|
Hello all, I need a little help. I'm calling a stored procedure from my
vb.net prog and I keep getting a syntax error. Could someone look at my code
and help me out a little. Thanks in advance.
Here is the procedure:
AddMember:
if exists (select * from sysobjects where id = object_id('dbo.AddMember')
and sysstat & 0xf = 4)
drop procedure dbo.AddMember
GO
CREATE PROCEDURE AddMember
@mbr_acctnum decimal(12,0),
@mbr_name varchar(50),
@mbr_ssn varchar(9),
@mbr_employee char(1)
AS
INSERT INTO Members (Account_Number, Member_Name, Social_Security_Number,
Employee)
VALUES (@mbr_acctnum, @mbr_name, @mbr_ssn, @mbr_employee)
GO
Here is the code:
'Create the ODBC objects
Dim OdbcCon As System.Data.Odbc.OdbcConnection
Dim OdbcCmd As System.Data.Odbc.OdbcCommand
'Instantiate new instances
OdbcCon = New System.Data.Odbc.OdbcConnection
OdbcCmd = New System.Data.Odbc.OdbcCommand
'Open a connection to an iSeries data source
OdbcCon.ConnectionString = _
"Driver={SQL Server};Server=" & _
pserver & ";Database=" & database & _
";Uid=" & puserid & "pwd=" & password
'Set up the procedure call
OdbcCmd.CommandText = "AddMember"
OdbcCmd.CommandType = CommandType.StoredProcedure
'Accosicate the command with the connection
OdbcCmd.Connection = OdbcCon
'Open the connection
OdbcCon.Open()
'Create the parameter objects to pass and get data from procedure
OdbcCmd.Parameters.Add("@mbr_acctnum", Odbc.OdbcType.Decimal, _
12, 0).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_name", Odbc.OdbcType.VarChar, _
50).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_ssn", Odbc.OdbcType.VarChar, _
9).Direction = ParameterDirection.Input
OdbcCmd.Parameters.Add("@mbr_employee", Odbc.OdbcType.Char, _
1).Direction = ParameterDirection.Input
'set the value of the parms to pass
OdbcCmd.Parameters(0).Value = 12
OdbcCmd.Parameters(1).Value = "xxxx wwww"
OdbcCmd.Parameters(2).Value = "444229999"
OdbcCmd.Parameters(3).Value = "Y"
'call the procedure
OdbcCmd.ExecuteNonQuery()
'put the results into a textbox control
'txtResult.Text = OdbcCmd.Parameters(1).Value
'close the connection
OdbcCon.Close()
Here is the error I receive:
MSSQLJOB 964-9a4 EXIT SQLExecDirectW with return code -1
(SQL_ERROR)
HSTMT 03A31BC0
WCHAR * 0x010C08E8 [ -3] "AddMember\ 0"
SDWORD -3
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_acctnum, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_name, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_ssn, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
AddMember expects parameter @mbr_employee, which was not supplied. (201)
Any help appreciated.
|
|
|
|
|
I don't know why, but I used this set of cade and now my problem is fixed.
'Create the ODBC objects
Dim OdbcCon As System.Data.Odbc.OdbcConnection
OdbcCon = New System.Data.Odbc.OdbcConnection
'Set up Connection String
OdbcCon.ConnectionString = _
"Driver={SQL Server};Server=" & _
pserver & ";Database=" & database & _
";Uid=" & puserid & ";Pwd=" & password
'Open the connection
OdbcCon.Open()
Dim OdbcCmd As OdbcCommand = OdbcCon.CreateCommand()
OdbcCmd.CommandText = "{ call AddMember(?,?,?,?) }"
Dim param As New OdbcParameter
param.DbType = DbType.Decimal
param.Value = 12
OdbcCmd.Parameters.Add(param)
param = New OdbcParameter
param.DbType = DbType.String
param.Value = "Mikey Ward"
OdbcCmd.Parameters.Add(param)
param = New OdbcParameter
param.DbType = DbType.String
param.Value = "444229999"
OdbcCmd.Parameters.Add(param)
param = New OdbcParameter
param.DbType = DbType.StringFixedLength
param.Value = "Y"
OdbcCmd.Parameters.Add(param)
OdbcCmd.ExecuteNonQuery()
OdbcCon.Close()
I hope someone else can benefit from this.
|
|
|
|