Jump to content
Xtreme .Net Talk

my_lou

Avatar/Signature
  • Posts

    45
  • Joined

  • Last visited

Everything posted by my_lou

  1. i get this error when i try to open one my CrystalReports files. A windows pops up and says "Microsoft Development Environment has encountered a problem and needs to close..." When i click on the "click here" link to see details about the error it says: "An unhandled exception has been caught by the VSW exception filter. AppName: devenv.exe AppVer: 7.10.3077.0 ModName: crdesigner.dll ModVer: 9.1.1.179 Offset: 00011192" It only happens on one of my CrystalReports.NET files. All the other ones open fine. My VB files open fine also. It's just that one file that's causing the error. The only difference between it and the other CrystalReports files i have that i can think of is that it contains two sub-reports. The application i am talking about is in Visual Basic .NET. I use Visual Studio.NET 2003 and i just installed the .NET Framework 1.1 SP. I am on a Windows XP machine. Any help would be greatly appreciated.
  2. what do you mean when you say 'massive'? i am not talking about result sets containg millions of rows. My biggest strongly typed DataSet will have no more 200,000 rows (and that's a very rough max estimate, it most likely will be something like 100,000). Even if i had a DataSet with 500,000 rows though i still don't think the overhead will be significant enough to affect the performance of the application.
  3. ok, here is the question i have. i am working on a desktop Windows application in VB.NET, backend is PostgreSQL 7.4.5. i've used strongly typed DataSets quite a bit in the application and they seem to be working fine so far. so i've been discussing the use of strongly typed DataSets with my sys admin and he claims that this approach would not be scalable. When i asked him why, here is what he said: "Because you're caching large chunks of the database locally. The overhead is massive, and with a multi user application, you're going to get flayed alive by write synchronization". My application will be used by approximately 20 users. My DataSets average about 15 tables each. I don't think any of the tables will exceed 100,000 rows of data. I am aware that DataSets pull data from the database and store it on the local machine, but that's the first i ever heard about the overhead being massive. Does he have a point?
  4. ok, this is aggrevating. i have the following PostgreSQL function: CREATE OR REPLACE FUNCTION public."MANIPULATEORDERDATAINFO_FUNCTION"(int4, int4, float4, int4, text, int4, text, text, date, text) RETURNS bpchar AS 'DECLARE argsItemID ALIAS FOR $1; argsCopiesOrdered ALIAS FOR $2; argsCost ALIAS FOR $3; argsStatusID ALIAS FOR $4; argsComments ALIAS FOR $5; argsSupplierID ALIAS FOR $6; argsRefNum ALIAS FOR $7; argsInvNum ALIAS FOR $8; argsDateOrdered ALIAS FOR $9; argsActionSelector ALIAS FOR $10; varIncomingOrderID Integer; BEGIN IF argsActionSelector = \'EDITITEM\' THEN SELECT IncomingOrderID INTO varIncomingOrderID FROM ORDERITEM WHERE OrderItemID = argsItemID; UPDATE ORDERITEM SET CopiesOrdered = argsCopiesOrdered, Cost = argsCost, OrderItemStatusID = argsStatusID, Comments = argsComments WHERE OrderItemID = argsItemID; UPDATE INCOMINGORDER SET SupplierID = argsSupplierID, ReferenceNumber = argsRefNum, InvoiceNumber = argsInvNum, DateOrdered = argsDateOrdered............... ................................................... which i know works fine because when i call it from CygWin it works just fine. The following is my CygWin output: => select public."MANIPULATEORDERDATAINFO_FUNCTION"(421, 34, 3.4, 1, 'tes t', 10, '44', '44', '2004-12-09', 'EDITITEM'); MANIPULATEORDERDATAINFO_FUNCTION ---------------------------------- (1 row) However when i try to call it from VB.NET i get an error: 'ERROR [HY000] ERROR: function public.ManipulateOrderDataInfo_Function(integer, integer, real, integer, "unknown", integer, "unknown", "unknown", date, "unknown") does not exist' Here is my VB.NET code: pgFunctionName = "SELECT public." & Chr(34) & "ManipulateOrderDataInfo_Function" & Chr(34) & "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" commonConnection = New OdbcConnection commonConnection.ConnectionString = DBConnectString Try commonConnection.Open() Catch Ex As Exception MsgBox("Failed to connect to PostgreSQL database from CommonFunctions.vb/ManipulateOrderItemInfo.") End Try 'End Try commonOdbcFunctionCommand = New OdbcCommand commonOdbcFunctionCommand.Connection = commonConnection commonOdbcFunctionCommand.CommandType = CommandType.StoredProcedure commonOdbcFunctionCommand.CommandText = pgFunctionName inputItemID = New OdbcParameter With inputItemID .Direction = ParameterDirection.Input .OdbcType = OdbcType.Int .ParameterName = "" .Value = argsItemID End With inputCopiesOrdered = New OdbcParameter With inputCopiesOrdered .Direction = ParameterDirection.Input .OdbcType = OdbcType.Int .ParameterName = "" .Value = argsCopiesOrdered End With inputCost = New OdbcParameter With inputCost .Direction = ParameterDirection.Input .OdbcType = OdbcType.Real .ParameterName = "" .Value = argsCost End With inputStatusID = New OdbcParameter With inputStatusID .Direction = ParameterDirection.Input .OdbcType = OdbcType.Int .ParameterName = "" .Value = argsStatusID End With inputComments = New OdbcParameter With inputComments .Direction = ParameterDirection.Input .OdbcType = OdbcType.Text .ParameterName = "" .Value = argsComments End With inputSupplierID = New OdbcParameter With inputSupplierID .Direction = ParameterDirection.Input .OdbcType = OdbcType.Int .ParameterName = "" .Value = argsSupplierID End With inputRefNum = New OdbcParameter With inputRefNum .Direction = ParameterDirection.Input .OdbcType = OdbcType.Text .ParameterName = "" .Value = argsRefNum End With inputInvNum = New OdbcParameter With inputInvNum .Direction = ParameterDirection.Input .OdbcType = OdbcType.Text .ParameterName = "" .Value = argsInvNum End With inputDateOrdered = New OdbcParameter With inputDateOrdered .Direction = ParameterDirection.Input .OdbcType = OdbcType.Date .ParameterName = "" .Value = argsDateOrdered End With inputActionSelector = New OdbcParameter With inputActionSelector .Direction = ParameterDirection.Input .OdbcType = OdbcType.Text .ParameterName = "" .Value = argsActionSelector End With commonOdbcFunctionCommand.Parameters.Add(inputItemID) commonOdbcFunctionCommand.Parameters.Add(inputCopiesOrdered) commonOdbcFunctionCommand.Parameters.Add(inputCost) commonOdbcFunctionCommand.Parameters.Add(inputStatusID) commonOdbcFunctionCommand.Parameters.Add(inputComments) commonOdbcFunctionCommand.Parameters.Add(inputSupplierID) commonOdbcFunctionCommand.Parameters.Add(inputRefNum) commonOdbcFunctionCommand.Parameters.Add(inputInvNum) commonOdbcFunctionCommand.Parameters.Add(inputDateOrdered) commonOdbcFunctionCommand.Parameters.Add(inputActionSelector) Try commonOdbcFunctionReader = commonOdbcFunctionCommand.ExecuteReader(CommandBehavior.Default) Catch Ex As Exception MsgBox(Ex.Message) End Try I am pretty sure that the problem is caused by the DATE parameter inputDateOrdered. I just can't figure out how to pass a date parameter to the PostgreSQL function. Any ideas? Thanks much.
  5. connecting to PostgreSQL db using the ODBC .NET Data Provider is easy. First you'll have to install a PostgreSQL ODBC driver (maybe plsqlODBC) and then create a data source (under System Tools>Data Sources). Then in VB.NET you do this: Imports System Imports System.Date Imports System.Data.Odbc Private Sub Something() Dim commonConnection As New OdbcConnection Dim reader As New OdbcDataReader commonConnection.ConnectionString = "DSN=datasourcename;UID=username;PWD=password" 'Open connection to an instance of the PostgreSQL database. Try commonConnection.Open() Catch Ex As Exception MsgBox(Ex.Message) End Try commonOdbcCommand = New OdbcCommand commonOdbcCommand.Connection = commonConnection commonOdbcCommand.CommandText = "Select * FROM DBTABLE" Try reader = commonOdbcCommand.ExecuteReader(CommandBehavior.Default) Catch Ex As Exception MsgBox(Ex.Message) End Try 'End Try If commonReader.HasRows Then While commonReader.Read 'DO Something End While End If commonOdbcCommand.Dispose() commonConnection.Close() End Sub
  6. ok, i have this Windows application in VB.NET i am currently working on. my backend currently is Oracle Enterprise Edition 8.1.7. However, i will most probably be switching to PostgreSQL due to licensing issues. The question i have is this, i have a few typed Datasets in my application and i was wondering if any problems with them could occur in the switch to PostgreSQL. I mean the table structure will be exactly the same, it's just that it will be PostgreSQL instead of Oracle. i wouldn't think there would be a problem, but i just thought i'd ask.
  7. just for the record, it's working fine now. i didn't do anything, it just started working on its own. yes, i did try rebooting when the problem was occuring earlier today and it did not help. and yes, i did look at the event viewer also, there was nothing there. i have not tried compiling from the command line though. how would i go about doing this? it's a VB.NET Windows application. somebody suggested that it might be a XP Service Pack 2 issue since i have XP Professional.
  8. hi all, ok, i have this problem. i have this VB.NET project and when i try to build/compile it or run it VS.NET just shuts down. No warning message, no error message, nothing, it just shuts down. anybody has any idea why this could be hapenning? the program is pretty big, i'd say around 50,000 lines of code, but i don't see how that would be a problem. thanks.
  9. hey folks, i am working on a Windows application (i am coding in VB.NET) to keep track of courses, students, instructors, student enrollments, student data, fees payment for courses, etc. It has come to my attention that this kind of application could greatly benefit from using barcodes/labels somehow, but i don't know how exactly. Anybody encountered a similar problem? If so any advice would be greatly appreciated. Thanks.
  10. oops, never mind that, it was a dumb mistake as are 99.99% of all coding errors. Since I am a nice person and I do not wish the anguish I went through upon anybody else, I'll clarify what the problem was. It was in the sub-routine SetParameters(). In it I had something like this: Private Sub SetParameters() Dim crDiscreteVal As New ParameterDiscreteValue Dim crParamField As New ParameterField ................ ................ For Each crParam As String In crReportParams Dim crParamName As String crParamName = ............. 'code to build name If crParamName <> "" Then 'Set the name of the parameter field. It must match a 'parameter field in the report. crParamField.ParameterFieldName = crParamName 'Set discrete value. crDiscreteVal.Value = ............ 'set discrete value 'Pass discrete value to parameter. crParamField.CurrentValues.Add(crDiscreteVal) 'Next add parameter to parameter fields collection. crParamFields.Add(crParamField) End If Next End Sub Do you see the problem with this code?...Well, here it is after the first time the ParameterField crParamField is inseretd in the collection crParamFields, it is never initialized so for the rest of the execution of the loop i just kep overwritting crParamField, hence inserting the same value in crParamFields over and over again. Dumb, I know! Anyway, here is how to make this work: Private Sub SetParameters() Dim crDiscreteVal As New ParameterDiscreteValue Dim crParamField As New ParameterField ................ ................ For Each crParam As String In crReportParams '*********************************************** ' NEW code here * '*********************************************** 'Initialize ParameterField and ParameterDiscreteValue variables to 'new instances of their respective classes so the values already 'inserted in the ParameterFields collection would not be overwritten. crDiscreteVal = New ParameterDiscreteValue crParamField = New ParameterField '*********************************************** ' NEW code here * '*********************************************** Dim crParamName As String crParamName = ............. 'code to build name If crParamName <> "" Then 'Set the name of the parameter field. It must match a 'parameter field in the report. crParamField.ParameterFieldName = crParamName 'Set discrete value. crDiscreteVal.Value = ............ 'set discrete value 'Pass discrete value to parameter. crParamField.CurrentValues.Add(crDiscreteVal) 'Next add parameter to parameter fields collection. crParamFields.Add(crParamField) End If Next End Sub So that took care of it.
  11. ok, i have the following situation: Crystal Report .NET untyped report with ReportDocument using strongly typed ADO.NET dataset for data access. I am opening the report in a Windows Form CrystalReportViewer. I want to pass parameters to it at runtime, but i can't figure out should i use the ParameterFieldInfo property of the CrystalReportViewer (in which case i'd have to use ParameterFields) or the DataDefintion.ParameterFields property of the ReportDocument class (in which case i'd have to use ParameterFieldDefinitions). To illustrate my point, here is some code. I use the following to pass parameters to Crystal Report using regular database, i.e. not DataSet, for data access and it works fine: Imports System Imports System.Collections Imports System.Collections.Specialized Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Friend WithEvents Generic_CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer Friend WithEvents GenericComponent_reportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Generic_CrystalReportViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer Me.GenericComponent_reportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument .... End Sub Private Sub GenericCRViewer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load _FileName = "myReport.rpt" Me.GenericComponent_reportDocument.Load(_FileName) Call Me.InitializeLogonCredentials() Call Me.SetParameters() Me.Generic_CrystalReportViewer.ParameterFieldInfo = crParamFields Me.Generic_CrystalReportViewer.ReportSource = Me.GenericComponent_reportDocument End Sub Private Sub SetParameters() 'CrystalReports report's parameter fields to the viewer control. Dim crParamField As New ParameterField Dim crDiscreteVal As New ParameterDiscreteValue crParamField.ParameterFieldName = CRREPORT_PARAMETER_SUFFIX & crParamName crDiscreteVal.Value = DirectCast(Me.crParameters(crParamName), Integer) 'Pass discrete value to parameter. crParamField.CurrentValues.Add(crDiscreteVal) 'Next add parameter to parameter fields collection. crParamFields.Add(crParamField) End Sub However, that same code does not work if my report uses DataSet for data access. I tried the following, without success: (this code added to the sub GenericCRViewer_Load) Dim reportData As New DataSet FillDataTable(True, "STUDENTTYPEID", reportData) Me.GenericComponent_reportDocument.SetDataSource(reportData) crPrmFieldDefinitions = Me.GenericComponent_reportDocument.DataDefinition.ParameterFields Call Me.SetParameters() For pfCount As Integer = 0 To crParamFields.Count - 1 crPrmFieldDefinitions(crParamFields(pfCount).ParameterFieldName).ApplyCurrentValues(crParamFields(pfCount).CurrentValues) Next 'End For In other words, i tried to populate the ParameterFieldDefintions collection with the members of the ParameterFields collection, with no luck. What's the difference between ParameterFields and ParameterFieldDefintions anyway and when should each one be used? Thanks all.
  12. o, i see what you are saying now. well, i've taken a different approach altogether. my data adapters do not reside in my form, rather i've put them in a separate module where they could service any and all of my forms, hence i only need to write the function "UpdateDataSource", which you saw in my first post, once and just perform calls to it from any form for any dataset as needed. it's all about code reuse, i.e. getting the maximum amount of work done with the minimum amount of code.
  13. you were right, the problem was in the CommandBuilder. to be more exact, the problem was in the following two lines: locCmdBuilder.QuotePrefix = "[" locCmdBuilder.QuoteSuffix = "]" basically what happened was it put the brackets ("[" and "]") around the table name and each field name, hence the table name was not recognized. so i just set those two properties to "": locCmdBuilder.QuotePrefix = "" locCmdBuilder.QuoteSuffix = "" and that took care of the problem. per the second part of your answer, are you suggesting global variables for the data adapter? if so, i don't see that as being more efficient than what i have. the idea behind that function that had the error in it was to be able to handle any sort of update, i.e. insert, delete, edit, to the data source from any table in the dataset, hence it was universal enough to channel all data source updates through it. And besides, not everything about the data adapter is static, the CommandText of the SelectCommand property changes for each table. Also, a global variable would require a place in memory that would not be released until the program/window was closed, while with the local variables in a function, they only exist while the fuction executes and are afterwards discarded, hence they reside in memory for much shorter amount of time, i.e. less resource intensive. maybe i misunderstood what you meant though. would you care to elaborate?
  14. ok, i have this function that populates my dataset (In VB.NET application using Oracle database): Public Function FillDataTable(ByVal argsPartialFill As Boolean, ByVal argsTableName As String, ByRef argsDataSet As DataSet) Dim localConn As OracleConnection Dim localOracleCommand As OracleCommand Dim locAdapter As New OracleDataAdapter localConn = New OracleConnection localConn.ConnectionString = OracleConnectionString 'Open connection to an instance of the Oracle database. Try localConn.Open() 'Initialize Oracle command and set necessary parameters. localOracleCommand = New OracleCommand localOracleCommand.Connection = localConn localOracleCommand.CommandText = DataTableString(argsTableName, argsDataSet) locAdapter.SelectCommand = localOracleCommand argsDataSet.Tables(argsTableName).BeginLoadData() locAdapter.Fill(argsDataSet, argsTableName) argsDataSet.Tables(argsTableName).EndLoadData() Catch Ex As Exception Throw Ex Finally 'Close database connection. localConn.Close() End Try 'End Try End Function So far so good, the dataset is filled with data and i can browse through throug it, etc. A problem occurs though when i want want to save the changes back to the data source. I use the following function to do so: Public Sub UpdateDataSource(ByVal argsRowState As DataRowState, ByRef argsDataTable As DataTable, ByRef argsDataSet As DataSet) Dim localConn As OracleConnection Dim locCommand As OracleCommand Dim locCmdBuilder As OracleCommandBuilder Dim locAdapter As New OracleDataAdapter Dim chngDataTable As DataTable localConn = New OracleConnection localConn.ConnectionString = OracleConnectionString locCommand = New OracleCommand 'Open connection to an instance of the Oracle database. Try localConn.Open() locCommand.Connection = localConn locCommand.CommandText = DataTableString(argsDataTable.TableName, argsDataSet) locAdapter.SelectCommand = locCommand locCmdBuilder = New OracleCommandBuilder(locAdapter) locCmdBuilder.QuotePrefix = "[" locCmdBuilder.QuoteSuffix = "]" locAdapter.InsertCommand = locCmdBuilder.GetInsertCommand locAdapter.Update(argsDataSet, argsDataTable.TableName) Catch Ex As Exception MsgBox(Ex.Message) Throw Ex End Try argsDataSet.AcceptChanges() localConn.Close() End Sub SO i get the following error on the "Catch Ex As Exception" line: ORA-00903 : invalid table name I am pretty sure the table name is right, but i guess i was wrong. Any ideas? Thanks.
  15. ok, nobody's answering, i guess it's a really hard question. here is a link i found that gives some insight into the problem: http://builder.com.com/5100-6387-1049764.html
  16. hey folks, i am faced with the following dilemma: i am designing a new CrystalReports report for the app i am working on and i am trying to decide whether to get the data for the report from a physical database or an ADO.NET DataSet. what are the advantages of using DataSets over physical database and vice versa? I am not going to be doing any drilling down on the report, just display the data and that's it.
  17. i have the following problem (excuse my ignorance if it's a dumb question, i am new to GDI+): i have a PictureBox in a Windows Form and then on it i draw a graphic and some text like so: Dim gStudyGuide As Graphics Friend WithEvents SGBackCover_PictureBox As System.Windows.Forms.PictureBox Me.SGBackCover_PictureBox = New System.Windows.Forms.PictureBox ' 'SGBackCover_PictureBox ' Me.SGBackCover_PictureBox.Dock = System.Windows.Forms.DockStyle.Fill Me.SGBackCover_PictureBox.Image = CType(resources.GetObject("SGBackCover_PictureBox.Image"), System.Drawing.Image) Me.SGBackCover_PictureBox.Location = New System.Drawing.Point(0, 0) Me.SGBackCover_PictureBox.Name = "SGBackCover_PictureBox" Me.SGBackCover_PictureBox.Size = New System.Drawing.Size(628, 734) Me.SGBackCover_PictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.SGBackCover_PictureBox.TabIndex = 0 Me.SGBackCover_PictureBox.TabStop = False Private Sub StudyGuideBack_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Variables initialization. gStudyGuide = Graphics.FromImage(Me.SGBackCover_PictureBox.Image) gStudyGuide.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias Call Me.DrawBarcode() Call Me.DrawISBN() End Sub 'End StudyGuideBack_Load Private Sub DrawBarcode() 'Variables declaration and initialization. Dim orgBmp As New Bitmap(Me.BarcodeDir & "\" & Me.ISBN & ".bmp") Dim newBmp As New Bitmap(orgBmp, orgBmp.Width, StudyGuide.DEFAULT_BARCODE_HEIGHT) 'Draw barcode image over PictureBox Image. gStudyGuide.DrawImage(newBmp, New Point(StudyGuide.BARCODE_X_COORDINATE, StudyGuide.BARCODE_Y_COORDINATE)) End Sub 'End DrawBarcode Private Sub DrawISBN() 'Variables declaration and initialization. 'Font and brush variables. Dim drawFont As New Font("Arial", 10) Dim drawBrush As New SolidBrush(Color.Black) 'Coordinates variables. Dim xCoordinate As Single = 1730.0F Dim yCoordinate As Single = 2760.0F 'Initialize string format. Dim drawFormat As New StringFormat drawFormat.FormatFlags = StringFormatFlags.NoWrap 'Draw ISBN string over PictureBox Image. gStudyGuide.DrawString(Me.ISBN, drawFont, drawBrush, xCoordinate, yCoordinate, drawFormat) End Sub 'End DrawISBN so far so good. what i want to do now is be able to change the font of the text i just drew. so to accomplish this a have a FondDialog control in my form and as soon as the user selects new font i'd like to basically replace the text drawn above with the same text but in a different font. the problem is i don't know how to delete text from a PictureBox. any ideas? i looked into MSDN documentaion and i found the Graphics.Clear method, but it doesn't seem to be doing what i need. of course i could always redraw everything in the PictureBox, but that would be...well lame. why redraw everything in it when i only need to change the text? any advice would be greatly appreciated. thanks.
  18. ok, let's say i have a typed DataSet with multiple tables and i want to populate it from a database. I know i have to populate the tables with parent fields first, for example let' say i have three tables Customer, Order, CustOrder. Customer and Order are parents and CustOrder is a child table. So what i have to do it something like this: Public Function FillDataTable(ByVal argsTableName As String, ByRef argsDataSet As DataSet) 'Variables declaration and initialization. Dim localConn As OracleConnection 'the Oracle connection variable Dim localOracleCommand As OracleCommand 'the Oracle Command variable Dim locAdapter As New OracleDataAdapter 'Variables initialization. localConn = New OracleConnection localConn.ConnectionString = OracleConnectionString 'Open connection to an instance of the Oracle database. Try localConn.Open() 'Initialize Oracle command and set necessary parameters. localOracleCommand = New OracleCommand localOracleCommand.Connection = localConn localOracleCommand.CommandText = "SELECT * FROM " & argsTableName 'Set "SelectCommand" parameter of OracleAdapter instance. locAdapter.SelectCommand = localOracleCommand locAdapter.Fill(argsDataSet, argsTableName) Catch Ex As Exception Throw Ex Finally 'Close datebase connection. localConn.Close() End Try 'End Try End Function So i call this function for each table in order of parent to child, i.e. for the above tables: FillDataTable(ds.CUSTOMER.TableName, ds) FillDataTable(ds.ORDER.TableName, ds) FillDataTable(ds.CUSTORDER.TableName, ds) So for three tables that's ok, but what if i had 20 or 30 or 50 tables in my typed dataset? I can't use the above method in that case, i have to find something more elegant. Any ideas? The only thing i can think of right now is to disable the constraints before filling the data set, then fill it, and then turn the constraints on again. Thanks all.
  19. i could be mistaken but i don't think you are understanding what i was saying. please look at my code carefully. i have a UserControl called UserControl1.vb. It has a TreeView control in it, amongst other controls. Unless I explicitly expose it to the rest of my application somehow, the TreeView's AfterSelect event will only be available inside UserControl1.vb. So the way to expose it is to declare a public event for my user control and perform a call to it when TreeView's AfterSelect event occurs.
  20. hey thanks Nerseus. The JoinView class looks exactly like what i was looking for and better yet, it's in VB.NET like my app so no conversion needed. Let me see now if i can get this thing to work.
  21. is there a way to get a DataView to contain data from multiple DataTables in a DataSet? The MSDN .NET framework says: "Represents a databindable, customized view of a DataTable....", i.e. just one DataTable per DataView. I was thinking of using DataViewManager, but it simply contains a collection of DataViews for the DataTables in the DataSet, i.e. you can't represent more than one table in a data view. Thanks.
  22. nope, not doing anything else after setting focus to the textbox, unless the AfterSelect TreeView event exhibits some kind of behavior i am not aware of. look at my first post, the last statement in routine myUserControl1_AfterSelect is a call to the function doing the focusing. nothing is supposed to be happening after that, although i may be wrong.
  23. actually yeah, i already did this, it does get the focus for a split second but then loses it. any ideas why? what's the difference between clicking on a node in the TreeView and using the arrows on the keyboard to switch nodes?
  24. ListView? There is no ListView, perhaps you mean TreeView. In my UserControl UserControl1 i have a TreeView control amongst other things. So in UserControl1 I have something like this: Public Class UserControl1 Inherits System.Windows.Forms.UserControl Friend WithEvents TreeView1 As System.Windows.Forms.TreeView TreeView1 = New System.Windows.Forms.TreeView ............................ Public Event AfterSelect(ByVal sender As Object, ByVal e As EventArgs) Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect .......................... .......................... RaiseEvent AfterSelect(sender, e) End Sub 'End TreeView1_AfterSelect End Class In other words when TreeView1 is clicked its event AfterSelect fires my custom UserControl event AfterSelect. I don't think the fact that they have the same name matters. Is that what you were asking?
  25. hey folks, i have a Windows Form and on it two user controls, the first one, UserControl1, has a TreeView control in it and the second one, UserControl2, has a TextBox in it, amongst other things. So i want when i click on any of the items in TreeView from UserControl1 the textbox in UserControl2 to receive input focus. So i wrote this little routine that's supposed to be doing just that, but it doesn't. Here is the code: Private Sub FocusItem() For Each workItem As UserControl2 In Me.Panel1.Controls If workItem.TextBox1.Text = "" Then workItem.TextBox1.Focus() Exit Sub End If Next 'End For End Sub 'End FocusItem [on the main form i place a bunch of controls of type UserControl2 in panel control Panel1] To ensure that this function is called when the TreeView in UserControl1 is clicked i have this routine: Private Sub myUserControl1_AfterSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles myUserControl1.AfterSelect ................................ ................................ Call Me.FocusItem() End Sub The problem is that it doesn't work. Well it doesn't when i click with the mouse on an item in the TreeView, but it does work when i switch between items using the arrow keys on the keyboard, i.e. if I click on the TreeView the TextBox does not receive input focus, but if I press a key it does. I've established through testing that the routine myUserControl1_AfterSelect is being called in both occasions, but for some reason the TreeView won't give up input focus when clicked on. Any ideas?
×
×
  • Create New...