|
no sorry i have never looked into creating objects at runtime, so i wouldnt know where to start. hopefully sum1 can post a how-to, and inform the both of us!
------------------------
Jordan.
III
|
|
|
|
|
Toola wrote:
Btw, i saw a function called CreateControl , but i really don't know what it does or what parameters it takes? i tried using it, but i failed , i keep giving it the wrong parameters!
do you know how to use it?
MSDN[^] is a great source of information. You will find that the PictureBox class that you are using inherits from System.Windows.Forms.Control , which contains a method called CreateControl() . Read more here[^] if you are interested.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanx alot Nick. I checked out MSDN's site & found it very useful, sure bet i'll be entering that site again!!
I already found a way to create a PictureBox at run time without using the CreateControl() method,
Simply as this:
Dim pb As New PictureBox<br />
System.Windows.Forms.Form1.Controls.Add(pb)<br />
(or Me.Controls.Add(pb))<br />
---------------------------
Toola
"The SMALL details are what make the difference in the BIG picture"
|
|
|
|
|
I want to set a launch condition so that if Office 2000 or newer is nt installed on the target machine, the installation will abort. What Registry value should I use for this?
Thanks!
|
|
|
|
|
You could try looking for the existence of the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0, 10.0 or 11.0.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi Friends,
I’m creating a database application for keeping password… I got an example of the Password Keeper project that is attached to this site, however in this project the programmer is using arrays to store data and I’m using a database. My database contains two tables; one for login information and the other for the password accounts information. There is a relationship between the two tables, so the user can inter more than one record. I’m facing problem two main problems, which are:
1- Connect the Date and Time Picker control to the database…
2- I want to combine the data in the login form with information in the account details form. For example when I login with my username and password to the system, it shows only the information that I have entered to the database and I can search only the data are related to my username (ID Account)… I don’t know if that can be possible or at least I can get examples of that…
By the way I’m beginner and I’m really doesn’t know when we have to use modules and for what!!!!!???
Regards,
Albadyaih
Albadyiah
|
|
|
|
|
Hello,
I know this forum, I am using vb.net and i want to create a report using Crystal Reports. The question i have is how do change the orientaion of the report from portriat to landscape? The default is landscape but I need to create a report in landscape because it is going to have alot of info on it.
Thank you,
Santana
|
|
|
|
|
Hi,
suppose you have set
<br />
Dim ObjCrystalR as NameofYourReport<br />
Then you just have to do the following :
<br />
objCrystalR.PrintOptions.PrinterName = strNomPrinter<br />
objCrystalR.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Portrait<br />
objCrystalR.PrintToPrinter(1, False, 0, 0)<br />
This code will set the Printer to strnomPrinter.
Change the orientation
And finally, printer 1 time the page.
Sybux
|
|
|
|
|
Thank you,
But, the question is how do you change the report in the crystal report design view to be in landscape, when you are creating it. I have it attached to a crystalreportsviewer form, i imagin if i can create the report in landscape the view will show it and print it in landscape. Can someone le tme know if i am right and how to do it.
Thanks
Santana
|
|
|
|
|
In my application, I have used an applicaton specific file extension for a binary file. I would like to add a unique icon to these files. I have looked in the MSDN in vain for instructions on how to do this. Can anyone help me?
Thanks!
|
|
|
|
|
If you mean that you a specific icon in Windows Explorer, you just have to create an entry in the registry.
Can have a look at HKEY_CLASSES_ROOT\htmlfile for exemple.
In this example, you will see how to set an icon (DefaultIcon) and see how to lunch an application when double click on it (Shell->Open)
For the icon, you have to option, a separate file ar included in your exe file. I you want to use second option, you will have to modify the propertie of your icon file in the projec Explorer of Visual Studio. You have to change the Build Action in Embedded Resource
Hope it will help you !
Sybux
|
|
|
|
|
Hi,
I know how to use datagrid in asp.net but I don't know how to use it in vb.
I've got a dataset with a datatable which contains all columns of a table.
I want to display only speficied columns in my datagrid but I don't know how to select them !
Thx
Sybux
|
|
|
|
|
i need vb.net API to fetch/retrieve email from smtp server, any suggestions?
regards,
asim mirza
|
|
|
|
|
i would also be interested if someone comes up with hints to develope such own routine at my own. like pop server component.
|
|
|
|
|
I'm trying to update some tables in an sql db when the Update button is clicked and got the following error:
Column 'TesterID' does not belong to table Table.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Column 'TesterID' does not belong to table Table.
Source Error:
Line 530: Return r("TesterID")
Source File: C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb Line: 530
Stack Trace:
[ArgumentException: Column 'TesterID' does not belong to table Table.]
System.Data.DataRow.get_Item(String columnName) +119
NewRecruit.PK.BusinessLogicLayer.Consumer.InsertTesterStuff() in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb:530
NewRecruit.PK.BusinessLogicLayer.Consumer.PKTesterUpdate() in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb:518
NewRecruit.Tester.btnUpdate_Click(Object sender, EventArgs e) in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Tester.aspx.vb:513
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263
Here is the code:
(stored procedure)
CREATE PROCEDURE usp_tp_UpdatePKTester
@TesterID char(7),
@LastName varchar(50),
@FirstName varchar(50),
@Address varchar(50),
@City varchar(50)
AS
IF EXISTS (SELECT TesterID FROM tTester WHERE TesterID = @TesterID)
BEGIN
UPDATE tTester
SET LastName= @LastName,
FirstName = @FirstName,
Address = @Address,
City = @City
WHERE (TesterID = @TesterID)
IF (@@ERROR <> 0) GOTO ErrorHandler
SELECT
1 AS RtnVal
END
ELSE
SELECT
-2 AS RtnVal
IF @@ERROR <> 0
GOTO ErrorHandler
ELSE
BEGIN
-- COMMIT
RETURN(0)
END
ErrorHandler:
BEGIN
-- ROLLBACK
RETURN(1)
END
GO
("Consumer" Class):
'call insert for tester
Public Function PKTesterUpdate() As Integer
Return InsertTesterStuff()
End Function
'Insert the Tester data
Private Function InsertTesterStuff() As Integer
Dim ds As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Web.Global.CfgKeyConnString), _
"usp_tp_UpdatePKTester", _
_TesterID, _
_LastName, _
_FirstName, _
_Address, _
_City)
Dim r As DataRow = ds.Tables(0).Rows(0)
Return r("TesterID")
End Function
("Tester" Web form):
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim PKTUpdate As DataTable = DirectCast(Session("GetPKTUpdate"), DataTable)
If PKTUpdate Is Nothing Then
PKTUpdate = New DataTable()
End If
Dim tu As New PK.BusinessLogicLayer.Consumer()
tu.TesterID = Request.QueryString("TesterID")
tu.TesterID = txtID.Text
tu.LastName = txtLName.Text
tu.FirstName = txtFName.Text
tu.Address = txtAddress.Text
tu.City = txtCity.Text
tu.PKTesterUpdate()
Session("GetPKTUpdate") = PKTUpdate
End Sub
Any help is much appreciated
Thank you,
jd
|
|
|
|
|
partt@pk-research.com wrote:
Dim r As DataRow = ds.Tables(0).Rows(0)
Apparently, .Tables(0) actually refers to a table call 'Table' and not what you think it should by using index 0 of Tables(). You'll have to trace into your SqlHelper class and figure out what's causing it to return the wrong table or multiple tables in the Dataset it returns.
RageInTheMachine9532
|
|
|
|
|
Thank you, running well now.
|
|
|
|
|
Hello! Everybody
I want to drag file from FileList Box from VB.NET forms to AUTOCAD (or any other application). Previously I did this useing OLEdrag but in .net OLE is obsolute. I need help. I will be greateful if anyone provide.
Thanks
|
|
|
|
|
See the DoDragDrop method for more information, as well as an example. .NET encapsulates the OLE drag and drop into (overly-)simple calls, also making use of the DragOver , DragDrop , and other related events.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I tried everything, I can drag and drop Text But I can not drag and drop files. U can try and test sample with windows explorer. If u can with explorer just send me sample code.
thanx
|
|
|
|
|
I've done it easily in the past. The only stipulation - without having to P/Invoke OLE's DoDragDrop function and the related OLE interfaces - is that you must have a file related to the item in your ListView . For example, lets say you store the actual path of the file in the ListViewItem.Tag property, so in the event handler for ListView.ItemDrag , you could do something like this:
Private Sub listView1_ItemDrag(ByVal sender As Object, ByVal e As ItemDragEventArgs)
Dim path As String = CStr(e.Tag)
Dim do As New DataObject(DataFormats.FileDrop, path)
listView1.DoDragDrop(do, DragDropEffects.Copy)
End Sub If your ListView contains "virtual" files that you need to stream to the drop target, you have to revert to OLE drag and drop, which can be done using P/Invoke and COM interop for declaring the related interfaces and structs.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
Thx for reply, I am sending my code herewith, I can drag file upto explorer but It could copy in explorer, send ur comments
Dim path1 As String = "C:\DWG\6420.dwg"
Dim dx As New DataObject(DataFormats.FileDrop, path1)
ListView1.DoDragDrop(dx, DragDropEffects.Copy Or dragDropEffects.Move)
I use same code in "ItemDrag" also.
Please do reply
Hemant
|
|
|
|
|
While a single string should work, also try a String() array with one element - the path. This does work. I've used it many times. Just make sure the file actually exists, since the .NET FCL doesn't expose other STGMEDIUM types (streams, storage, etc.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am trying from last 1-2 days. But Explorer does not recognise and can not perform actions like copy/move. As soon as I started dragging a file from windows (VB.NET) application to Explorer ICON gets changed but it does ot perform any action for file copy OR file Move.
If anyone can provide me a sample code i will be very gr8ful.
Thanks
Hemant
|
|
|
|
|
I have a page where I am uploading an image. When the page is first called, the current image is displayed, after they upload a new one image, the new image is displayed. Here is my logic, When I use the code in red, the image displays and refreshes after hitting upload when working on my local computer. But when I move it over to the server. I get the broken image icon for the images. So I used the code in green and the images would show up fine. But I have to hit refresh after I upload to get the new picture to display. The code in blue is where i view the uploaded picture. Also the ConfigurationSettings.AppSettings("PhotoPath") 's value is
"../Images\ReatorPics\"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
PopulateCurrentImageInfo()
End If
End Sub
Sub PopulateCurrentImageInfo()
Dim vUserID As String
vUserID = HttpContext.Current.User.Identity.Name.ToString
CurrentPhotoInfo.Text = mlsgateway.DatabaseCalls.Searches.ReturnRealtorImage()
CurrentPhotoInfo.Style("Color") = "red"
NewImage.ImageUrl = Server.MapPath(ConfigurationSettings.AppSettings("PhotoPath")) & vUserID & ".jpg")
'NewImage.ImageUrl = ConfigurationSettings.AppSettings("PhotoPath") & vUserID & ".jpg")
NewImage.Visible = True
End Sub
'upload image
Sub Button_Click(ByVal s As Object, ByVal e As System.EventArgs)
'''''''''''grab property number and set path to images folder
Dim vUserID As String
vUserID = HttpContext.Current.User.Identity.Name.ToString
Dim vPath As String = ConfigurationSettings.AppSettings("PhotoPath")
''''''''''obtain info about posted file
Dim ImageFileUp = uploadedFile.PostedFile
Dim ImageFileName As String = Path.GetFileName(ImageFileUp.FileName)
Dim ImageFileType As String = ImageFileUp.ContentType.ToString
'''''''''''save the orignal image to make it easier to manipulate
uploadedFile.PostedFile.SaveAs(Server.MapPath(vPath) & "/TempImages/" & ImageFileName)
''''''''''create a new bitmap from the saved file
Dim temp As String
Dim G As Bitmap
G = New Bitmap(Server.MapPath(vPath) & "/TempImages/" & ImageFileName)
Dim GFormat = G.RawFormat
Dim vWidth As Integer = CType(G.Width, Integer)
Dim vHeight As Integer = CType(G.Height, Integer)
'''''''''run function to obtain new image sizes
Dim NewImageSize As New Size
vWidth = vWidth * 5000
vHeight = vHeight * 5000
NewImageSize = ResizeImage(vWidth, vHeight)
''''''''create new bitmap with old bitmap but new width and height
Dim B As New Bitmap(G, NewImageSize.Width, NewImageSize.Height)
Try
'''''''try and save resized image and convert it to jpeg
'''''''then display old info and new info plus new image
'''''''dispose of image objects
B.Save(Server.MapPath(vPath) & vUserID & ".jpg", ImageFormat.Jpeg)
Dim vUserType As String = Request.Cookies("UserInfo")("UserType")
If vUserType <> "M" Then
SaveImageNameToDBNonMLSUser(vUserID)
Else
SaveImageNameToDBMLSUser(vUserID)
End If
Message.Text = "Image upload complete! "
ImageInfoPrevious.Text = "Old File Name: " & ImageFileName & " Old File Type: " & ImageFileType & " "
ImageInfoNow.Text = "New File Name: " & vUserID & ".jpg New File Type: " & "JPEG"
PopulateCurrentImageInfo()
NewImage.Visible = True
G.Dispose()
B.Dispose()
Catch ObjException As SqlException
Dim ObjError As SqlError
Message.Text = " Image Upload did not complete. Please try again. The error was : " & ObjException.Number & " " & ObjException.Message
Message.Style("color") = "red"
End Try
Page_Load(s, e)
''''''''''call sub to clean up the temp image
'RemoveTempImage(ImageFileName, vPath)
End Sub
Function ResizeImage(ByVal currentwidth, ByVal currentheight)
''''''''''''change 256 value to what ever you want the thumbnail to be returned as
''''''''''''checks to see if it is portait or landscape
Dim TempMultiplier As Double
If currentheight > currentwidth Then
TempMultiplier = 100 / currentheight
Else
TempMultiplier = 100 / currentwidth
End If
Dim NewSize As New Size(CInt(currentwidth * TempMultiplier), CInt(currentheight * TempMultiplier))
Return NewSize
End Function
Sub SaveImageNameToDBMLSUser(ByVal vUserID As String)
''''''''''''saves the new image info into the database.
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("Conn_MLSGateway"))
Dim SQL As String
SQL = "Update Assoc_Image_Name Set Image = '" & vUserID & ".jpg' Where LoginID = '" & vUserID & "'"
Dim MyCommand As New SqlCommand(SQL, MyConnection)
MyCommand.Connection.Open()
MyCommand.ExecuteNonQuery()
MyCommand.Connection.Close()
'Response.Write(SQL)
End Sub
Sub SaveImageNameToDBNonMLSUser(ByVal vUserID As String)
''''''''''''saves the new image info into the database.
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("Conn_International"))
Dim SQL As String
SQL = "Update Users Set Image = '" & vUserID & ".jpg' Where EmailAddress = '" & vUserID & "'"
Dim MyCommand As New SqlCommand(SQL, MyConnection)
MyCommand.Connection.Open()
MyCommand.ExecuteNonQuery()
MyCommand.Connection.Close()
End Sub
Sub RemoveTempImage(ByVal vImageName As String, ByVal vPath As String)
'this will clean up disk for the old photos that are placed pre resize and conversion.
Dim objFSO
objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(vPath & vImageName, False)
objFSO = Nothing
End Sub
|
|
|
|
|