|
//Crystal Report Object
CrystalReport2 cp = new CrystalReport2();
CReport cp1 = new CReport();
//Form Load Event
private void Form2_Load(object sender, System.EventArgs e)
{
crystalReportViewer1.ReportSource = cp;
}
//Link Label Click Event
private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
try
{
string empid = textBox1.Text.Trim();// H-B39728F employee id
SqlConnection con = new SqlConnection("server=SK-WAQAS;uid=sa;pwd=Butt;database=pubs");
SqlDataAdapter daemp = new SqlDataAdapter("Select * From employee where emp_id= '" + empid + "'", con);
DataSet ds = new DataSet();
daemp.Fill(ds,"employee");
cp.SetDataSource(ds);
con.Close();
}
catch(Exception ce)
{
MessageBox.Show(ce.Message);
}
}
// End Code
When i run this code no record show in Crystal Report. Please tell me where is do mistake. I want to show record in crystal report on the base of emp_id , i use pubs database on Sql server 2000.
Thanks in advance.
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
I am developing a video conferencing program. It is intended to work on internet. I used AVICAP to capture video from webcam. The method i intended to used to stream video is capture a frame from webcam then send it over to the other PC and then repeat it again. The other PC will paste the frame received to the picture box upon receive the bmp file. My problem is I do not know i should choose either TCP/IP, UDP or socket as my connection method? And i do not know how to stream audio captured across internet. Can any1 give some help here either by giving me some sample video conferencing program (vb.Net) or giving some guildance and tutorial ?
-- modified at 2:43 Sunday 2nd October, 2005
|
|
|
|
|
|
See here[^]!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
What question?
All you've done is copy/paste in your homework assignment. This is a great way to your "question" ignored.
Ask something specific and we can help with that. The whole point of you getting a homework assignmnet is to see if you're understanding the what's being taught in the class and if you understand how to apply it to problems. If all you're doing is copying/pasting the assignment into a forum, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
this is the code I have been trying for hrs. Trackbar control only Vertical and horizontal. Now how do I control the diameter?
Public Class Form1
Inherits System.Windows.Forms.Form
Private paper As Graphics
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
paper = Me.PictureBox1.CreateGraphics
Me.VertTrackBar.Minimum = 0
Me.VertTrackBar.Maximum = Me.PictureBox1.Height
Me.Label1.Text = CStr(Me.VertTrackBar.Value)
Me.HoriTrackBar.Minimum = 0
Me.HoriTrackBar.Maximum = Me.PictureBox1.Width
Me.Label2.Text = CStr(Me.HoriTrackBar.Value)
Me.HoriDiaTrackbar.Minimum = 0
Me.HoriDiaTrackbar.Maximum = Me.PictureBox1.Width
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents VertTrackBar As System.Windows.Forms.TrackBar
Friend WithEvents HoriTrackBar As System.Windows.Forms.TrackBar
Friend WithEvents HoriDiaTrackbar As System.Windows.Forms.TrackBar
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents btnDraw As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.VertTrackBar = New System.Windows.Forms.TrackBar
Me.HoriTrackBar = New System.Windows.Forms.TrackBar
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.HoriDiaTrackbar = New System.Windows.Forms.TrackBar
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.btnDraw = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
CType(Me.VertTrackBar, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.HoriTrackBar, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.HoriDiaTrackbar, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'VertTrackBar
'
Me.VertTrackBar.Location = New System.Drawing.Point(88, 48)
Me.VertTrackBar.Name = "VertTrackBar"
Me.VertTrackBar.Orientation = System.Windows.Forms.Orientation.Vertical
Me.VertTrackBar.Size = New System.Drawing.Size(45, 300)
Me.VertTrackBar.TabIndex = 0
'
'HoriTrackBar
'
Me.HoriTrackBar.Location = New System.Drawing.Point(152, 360)
Me.HoriTrackBar.Name = "HoriTrackBar"
Me.HoriTrackBar.Size = New System.Drawing.Size(300, 45)
Me.HoriTrackBar.TabIndex = 1
Me.HoriTrackBar.TickStyle = System.Windows.Forms.TickStyle.TopLeft
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(160, 40)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(300, 300)
Me.PictureBox1.TabIndex = 2
Me.PictureBox1.TabStop = False
'
'HoriDiaTrackbar
'
Me.HoriDiaTrackbar.Location = New System.Drawing.Point(152, 424)
Me.HoriDiaTrackbar.Name = "HoriDiaTrackbar"
Me.HoriDiaTrackbar.Size = New System.Drawing.Size(300, 45)
Me.HoriDiaTrackbar.TabIndex = 3
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(80, 384)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 40)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Label1"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(472, 368)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 32)
Me.Label2.TabIndex = 5
Me.Label2.Text = "Label2"
'
'btnDraw
'
Me.btnDraw.Location = New System.Drawing.Point(520, 168)
Me.btnDraw.Name = "btnDraw"
Me.btnDraw.Size = New System.Drawing.Size(88, 40)
Me.btnDraw.TabIndex = 6
Me.btnDraw.Text = "Draw"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(480, 424)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(64, 32)
Me.Label3.TabIndex = 7
Me.Label3.Text = "Label3"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(640, 486)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.btnDraw)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.HoriDiaTrackbar)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.HoriTrackBar)
Me.Controls.Add(Me.VertTrackBar)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.VertTrackBar, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.HoriTrackBar, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.HoriDiaTrackbar, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub VertTrackBar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VertTrackBar.Scroll
Dim myPen As Pen = New Pen(Color.Black)
Me.Label1.Text = CStr(Me.VertTrackBar.Value)
paper.Clear(Color.White)
paper.DrawEllipse(myPen, 0, 0, Me.HoriTrackBar.Value, Me.VertTrackBar.Value)
End Sub
Private Sub HoriTrackBar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HoriTrackBar.Scroll
Dim myPen As Pen = New Pen(Color.Black)
Me.Label2.Text = CStr(Me.HoriTrackBar.Value)
paper.Clear(Color.White)
paper.DrawEllipse(myPen, 0, 0, Me.HoriTrackBar.Value, Me.VertTrackBar.Value)
End Sub
Private Sub HoriDiaTrackbar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HoriDiaTrackbar.Scroll
Dim myPen As Pen = New Pen(Color.Black)
Me.Label3.Text = CStr(Me.HoriDiaTrackbar.Value)
paper.DrawEllipse(myPen, 0, 0, Me.HoriDiaTrackbar.Value, Me.HoriDiaTrackbar.Value)
'paper.DrawEllipse(myPen, Me.HoriTrackBar.Value, Me.VertTrackBar.Value, Me.HoriTrackBar.Value, Me.VertTrackBar.Value)
'paper.DrawEllipse(myPen, 0, 0, Me.HoriTrackBar.Value, Me.VertTrackBar.Value)
End Sub
Private Sub btnDraw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDraw.Click
Dim myBrush As SolidBrush = New SolidBrush(Color.Black)
paper.FillEllipse(myBrush, 100, 100, 10, 10)
paper.FillEllipse(myBrush, 200, 200, 10, 10)
paper.FillEllipse(myBrush, 200, 100, 10, 10)
End Sub
End Class
|
|
|
|
|
You still haven't supplied much information.
I take it you have to control both the position and the size of the circle.
You're drawing a cicle from the top/left corner of the picture box ALL THE TIME. You're not tracking the position of the circle at at all.
You have to track the center of the circle with the two trackbars. Easy enough, you already have them in place. Eliminate all the drawing code from the trackbars, you don't need any of it. The trackbar code will just alter the position and size of the circle. Then call the Invalidate method of the PictureBox control your painting on.
You only need a single Draw statement, inside the Paint event handler for the PictureBox control. Here is where you'll calculate the top/left and bottom/right corners of the box that will be used to draw your circle. It's simple math.
The top/left will be the position of the circle minus hald the diameter. The bottom/right will be the position plus half the diameter.
Don't even thnik of asking for the code. You're in a class to learn to write it yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you so much Master.
|
|
|
|
|
Dave
I took this challenge and found I'm having a tough time understang the logic flow of the object model.
I get the circle to draw in the center of the PictureBox, but it is fleeting - it disappears as soon as it is drawn. I debugged only to find the circle vanishes as soon as I exit the Paint event on the PictureBox.
Where am I failing?
Public Class Form1
Private _paper As Graphics
Private _pen As Pen = New Pen(Color.Black, 3)
Private Sub Form1_Load(....) Handles MyBase.Load
_paper = Me.uxCanvasPicbx.CreateGraphics()
End Sub
Private Sub uxDiameterTrkbar_Scroll(....) Handles uxDiameterTrkbar.Scroll
uxDiameterLbl.Text = uxDiameterTrkbar.Value.ToString
uxCanvasPicbx.Invalidate()
End Sub
Private Sub uxCanvasPicbx_Paint(....) Handles uxCanvasPicbx.Paint
Dim ul, lr As Integer
lr = Me.uxDiameterTrkbar.Value
ul = ((200 - lr) / 2)
_paper.Clear(Color.White)
_paper.DrawEllipse(_pen, ul, ul, lr, lr)
End Sub
End Class
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Karen,
Original question that I posted was How do I control the diameter of a circle. I was able to control the Horizontal and the Vertical.
|
|
|
|
|
The problem is because your using your own Graphics object and you don't need to. The Graphics object is supplied to you in the args for the Paint event. If you use your's, everything you paint will be overlayed by the Graphics object in the Paint event args.
Sooooo....
Public Class Form1
Private _pen As Pen = New Pen(Color.Black, 3)
Private Sub uxDiameterTrkbar_Scroll(....) Handles uxDiameterTrkbar.Scroll
uxDiameterLbl.Text = uxDiameterTrkbar.Value.ToString
uxCanvasPicbx.Invalidate()
End Sub
Private Sub uxCanvasPicbx_Paint(....) Handles uxCanvasPicbx.Paint
Dim g As Graphics = e.Graphics
Dim ul, lr As Integer
lr = uxDiameterTrkbar.Value
ul = ((200 - lr) / 2)
g.Clear(Color.White)
g.DrawEllipse(_pen, ul, ul, lr, lr)
End Sub
End Class
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
I am receving stream of data from the serial port com1.
My problem is that what should I do to display this online data in graph or chart using VB6.0
Could someone pls enlighten me on this?
Thanks
|
|
|
|
|
does anyone know of a control (third-party or otherwise) that allows viewing/manipulation of an excel spreadsheet or a specific range on a spreadsheet?
|
|
|
|
|
Hi..Take a look here, should tell you all you need to know about automating Excel from .NET etc.. )
Understanding the Excel Object Model from a .NET Developer's Perspective
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_ta/html/ExcelObj.asp
|
|
|
|
|
Hello,
ComponentOne has a control, XLS.NET, that will allow you to open and manipulate existing Excel files as well as create new ones. Rows and columns are accessed like a grid, so the object model will be familiar to most users. We also have a grid control, FlexGrid.NET, that allows you to load Excel files into the grid and save the grid layout and data to an xls file.
If you are interested, more information is available at http://www.componentone.com. All of our products are available as fully functioning evaluations at http://www.componentone.com/Downloadcenter.aspx?PanelIndex=4.
Happy Friday
Suelinda W
Customer Engagement, ComponentOne LLC
|
|
|
|
|
Greetings! me again.
In a listview, how can I get the index # of the currently slected row?
I see how to get a collection of selected items and a collection of checked items, but not the last selected item.
It's been a long rainy day, help please.
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
I'm not at my machine with '05 on it, but is there not a Object.SelectedItem.Index property? If not you will need to code a loop for 0 to count-1 to go through and try to match the selected item (i.e. object.items(loopvar) = object.selecteditem then loopvar will have your index value and you can exit the for loop.
|
|
|
|
|
Thanks all!
I found it, just thought I'd pass it on.
uxFileLstvw.FocusedItem.Text
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Hello,
This is my first go at implementing an interface for a connection, reader, ect.. and it is also my first go at a three tier design,Although i have been studing this for some time now tring to put all of these pieces togeather. I feel like i am getting to a point that i can comfortably work with this type of suggest design.
I am having trouble connecting to the database. The error that i am getting says that the object is not set to an instant of an object,, ( ok so i might say hey,, i kown what this is, but with the interfaces there is no way to just say, dim my iDBC as new idbconnection)'' Can someone please look at my code and help me pinpoint what needs to be corrected. Not just the connection but the rest of the implementation.It would really help me out alot, because i am into new waters.
===================
*** this is what i have created to test with so that once i can get going with this then i can move forward with the real stuff.. I would be so greatful to have developers that can point out a better way of strongly typeing my database here.. One of the reasons that i want to learn implementing this this way is because from what i understand this is the correct way(maybe not exactly the way that i have it ).. Any help at all would be great!!!
From the form page......................
-------------------------------------------------------------------
Imports DA = SuperCenter.DataAccess.Blinds
Namespace SuperCenter.Web
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetNumbers()
End Sub
'
Public Sub GetNumbers()
Dim pk As Int32 = 3
With New DA
ddl.DataSource = .GetNumbers(Request.QueryString("pk"))
ddl.DataBind()
End With
End Sub
End Class
End Namespace
============================================================
===============================================
dataaccess
=============================================
Imports System.Data.SqlClient
Imports DATA = SuperCenter.Data
Namespace SuperCenter.DataAccess
Public Class Blinds
Private _Datareader As IDataReader
Private _cnn As IDbConnection
Const DATABASE = "Data Source=Desktop; Initial Catalog=TEST; Trusted_Connection=True"
'
Public Sub New()
With _cnn
.ConnectionString = DATABASE **** My error is right here****
End With
End Sub
'
Public Function GetNumbers(ByVal pk As Int32) As Data.Blinds
'
GetNumbers = SharedAccess("BlindGetNumbers", "@pk", pk)
End Function
'
Private Function SharedAccess(ByVal BlindSprocName As String, _
ByVal parmName As String, _
ByVal parmvalue As Int32) As Data.Blinds
Dim B As Data.Blinds
Dim BL As New Data.BlindList
Dim cmd As IDbCommand
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = BlindSprocName
Dim ipram As IDataParameter
With ipram
.DbType = DbType.Int32
.ParameterName = parmName
.Value = parmvalue
End With
.Parameters.Add(ipram)
End With
_cnn.Open()
_Datareader = cmd.ExecuteReader
While _Datareader.Read
BL.add(New Data.Blinds(_Datareader("Numbers")))
End While
_cnn.Close()
_Datareader.Dispose()
_Datareader.Close()
'
If _cnn.State = ConnectionState.Open Then
_cnn.Close()
If _Datareader.IsClosed = False Then
_Datareader.Close()
_Datareader.Dispose()
End If
End If
End Function
'
End Class
End Namespace
=======================================================
Property page---------------------------
================================================
Namespace SuperCenter.Data
Public Class Blinds
Private _Width As String
Private _Tall As String
Private _Numbers As String
Private _Colors As String
Private _Extras As String
Public Sub New()
End Sub
Public Sub New(ByVal Numbers As String)
_Numbers = Numbers
End Sub
'
Public Sub New(ByVal Width As String, _
ByVal Tall As String, _
ByVal Numbers As String, _
ByVal Colors As String, _
ByVal Extras As String)
_Width = Width
_Tall = Tall
_Numbers = Numbers
_Colors = Colors
_Extras = Extras
End Sub
'
Public Property Width() As String
Get
Return _Width
End Get
Set(ByVal Value As String)
_Width = Value
End Set
End Property
'
Public Property Tall() As String
Get
Return _Tall
End Get
Set(ByVal Value As String)
_Tall = Value
End Set
End Property
'
Public Property Numbers() As String
Get
Return _Numbers
End Get
Set(ByVal Value As String)
_Numbers = Value
End Set
End Property
'
Public Property Colors() As String
Get
Return _Colors
End Get
Set(ByVal Value As String)
_Colors = Value
End Set
End Property
'
Public Property Extras() As String
Get
Return _Extras
End Get
Set(ByVal Value As String)
_Extras = Value
End Set
End Property
End Class
End Namespace
===================================================
CollectionBase page
==============================================
Namespace SuperCenter.Data
Public Class BlindList : Inherits CollectionBase
'
Public Sub New()
End Sub
'
Public Function add(ByVal blind As Blinds) As Int32
Return Me.add(blind)
End Function
'
Default Public ReadOnly Property item(ByVal index As Int32)
Get
Return CType(item(index), Blinds)
End Get
End Property
'
End Class
End Namespace
|
|
|
|
|
OK, first of all, the reason why you would create a generic interface for data access is to hide the database implementation from your application.
For example, if you want to write a single front-end application that will work with both Access and SQL Server, then you wouold create generic interfaces like IConnection, IParameter, ICommand. Your application would work with these interfaces only.
Then you would have two families of classes, one for Access, one for SQL Server, that implement the common interfaces.
In your code, you are explicitly using the SqlClient family of data access. Now, there is absolutely nothing wrong with doing this. But there is no point in doing both - if you are going to explicitly bind your application to SQL Server, there is no point in going through interfaces.
Assuming you want to use interfaces, and not bind to a specific database type, you have to create implementation classes. As you point out, you cannot declare an Interface class as New. That is because the interface is only a definition. Instead what you need to do is create an implementation class that returns objects that implement the interfaces.
You never actually work with a SqlConnection. Instead you work through a custom class that entirely encapsulates the connection object for you.
This is difficult to explain.
There is a book, however, that has a full set of working examples for using indirect data access through interfaces:
Professional Design Patterns in VB.NET, by Fischer, et al. Published by a-Press. I think their code is available on the publishers website, but you really need the book to understand the concepts.
|
|
|
|
|
thank you for your help!
I will go with your suggestion and lay off of the Interfaces, i believe it is beyond my brain at this point! ~ However i will look for the book in the coming weeks...
erik..
|
|
|
|
|
Creating a truly functional abstract data access interface/implementation architecture is extremely challenging. Fischer et al devote almost 50 pages to the subject, and at the end they have only implemented two generic objects - DataReader and DataSet objects. A Data Reader is a forward, read only object - not too complicated. And a DataSet is already platform independent by nature.
And they "cheat" a lot too - their design assumes all parameters are strings, for example.
It's not easy. People struggle with these concepts for a long time. The best thing to do is start small - create small experimental projects until you rfeally understand how the interface and implementations really fit together.
|
|
|
|
|
Greetings!
Private Sub uxGpDirectoryTree_DoubleClick( _
ByVal sender As Object, ByVal e As System.EventArgs) _
Handles uxGpDirectoryTree.DoubleClick
uxBaseDirCmbbx.Text += uxGpDirectoryTree.SelectedNode.Text + "\"
End Sub
Everytime this code is invoked, it invokes another method (uxBaseDirCmbbx.SelectedIndexChanged) - except for the last subfolder. I assume this is because the Text property has changed.
So why not on the last subfolder?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Greetings!
I'm having trouble with my treeview. Once I select a node from the treeview, it invokes the AfterSelect event, re-fills my nodes and the re-executes the AfterSelect event (again) - thus re-filling my node tree:
Private Sub uxGpDirectoryTree_AfterSelect( _
ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) _
Handles uxGpDirectoryTree.AfterSelect
Me.StartDir += uxGpDirectoryTree.SelectedNode.Text + "\"
call fillDirectoryTree()
End Sub
Private Sub fillDirectoryTree()
Dim arrSubfolders() As DirectoryInfo
arrSubfolders = New DirectoryInfo(Me.StartDir).GetDirectories
uxGpDirectoryTree.Nodes.Clear()
For Each subfolder As DirectoryInfo In arrSubfolders
uxGpDirectoryTree.Nodes.Add(subfolder.Name)
Next
End Sub
I have debugged and it does cycle more than once. Any help would be greatly appreciated.
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|