|
Thanks, Phil!
I will definitely look into that.
____________________________________________________________________________________
The Vulcan Science Directorate has determined that time travel is impossible.
|
|
|
|
|
I dont know if anyone has suggested this yet, but have you looked at the Csla[^] Framework?
You decouple the presentation from the Business layer and the DataLayer. There are heaps of examples, and the Author describes using a Windows UI, A WPF UI and also a Web Interface. You can even target mobile platforms.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Hi BobishKindaGuy,
What an excellent discussion you have set off, thanks. My personal opinion is that we are in a time of a great "flux" of technologies converging on bridging what have been the disparate worlds of "desktop applications" (control intensive, data intensive) and web-sites (content intensive, navigation intensive).
Having a substantial investment in C# and WinForms, I have of course considered moving to ASP.NET and its recent MVC MVVM flavours with Ajax : but when you look at what a dog Ajax turned out to be, and the current ubiquitous adoption of JavaScript libraries like jQuery by MS, I'm tempted to follow the lead of a world-class .NET developer I know and just "jump ship" for PhP, using jQuery for interface.
Of course I want the "deeper" graphics object/model of WPF, of course I want the more sophisticated event model of WPF, and the powerful binding concepts of WPF, but going back and forth between XAML and C# is, for me, a trip back to the stone age. But I also want to use the great 3rd. party WinForm controls I've invested in learning how to use well.
It says "acres" to me about SilverLight that on my .NET development machine here (Win Vista, using IE8) with all the latest updates installed for everything related to .NET, SilverLight, etc. that going to the myVBProf page you mention starts a full-screen SilverLight app which loads 100% but never plays with a JavaScript error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.30729; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Thu, 29 Jul 2010 03:35:59 UTC
Message: '_gat' is undefined
Line: 113
Char: 9
Code: 0
URI: http://www.myvbprof.com/MainSite/index.aspx
imho it's far from clear that WPF and SilverLight are here for the "long run," and the upcoming HTML 5 standard, and possibly an "ex-Flash" era, coupled with the surge toward applications that can be viewed on small/mobile devices is going to change the game. I haven't yet really taken a look at Adobe's Air, and the current incarnations of DreamWeaver, etc., and how they play together with Flash.
All kinds of strange, mutant technologies are springing up trying to bridge web and desktop application paradigms ... Aptana Studio (Aptana ... okay, it's an IDE, not really that strange) and Alpha 5 (AlphaSoftware) come to mind) ... as well as what are, imho, "grandiose" attempts, like Titanium (Appcellerator), to cross not only platform boundaries, but device form-factor boundaries, also.
I'm waiting a while longer to decide which Web technology to invest in.
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Silverlight and WCF would seem to be a natural fit.
/ravi
|
|
|
|
|
I believe that my questions are all going to revolve around the internal workings of DataGridView.
I've been trying to find a forum where I can get some interaction and help to move forward.
Microsoft's websites seem to be all questions and no answers.
I'm using VB.Net under Visual Studio 2005 SP2.
I need to have a DataColumn that is dynamically visible based on other data in the same DataRow.
After a lot of unsuccessful testing with various methods of accomplishing this, I came across the concept of Custom Cells/Columns.
I started with several slightly varying examples and everything seemed to be falling into place. I tried to research each property and attribute as I incrementally learned a lot about the internal workings of Windows controls in general and DataGridView in particular.
The confusing symptom is that as I scroll down through the grid, the painting of the custom cells is at best unreliable.
I created a minimum test case to eliminate as many variables as possible and I combined all of the source into one Form1.vb as follows:
Option Explicit On
Option Strict On
Public Class Form1
Public m_OrderDetails As Generic.List(Of OrderDetail)
Public m_dgv As New System.Windows.Forms.DataGridView
Public Enum GridViewColumnType
TextBox
InvisibleTextBox
End Enum
Public Sub New()
MyBase.New()
InitializeComponent()
' fake the usual load procedures with minimum so this screen can stand alone
m_OrderDetails = New Generic.List(Of OrderDetail)
Dim LineCounter As Int32 = 0
Dim ItemCounter As Int32 = 0
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.Percent)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.ItemCodes)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.Percent)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.Dollars)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.Percent)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.ItemCodes)
GenerateSetOfLines(LineCounter, ItemCounter, OrderDetail.ProductItemDealerSplitType.Percent)
End Sub
Private Sub GenerateSetOfLines(ByRef linecount As Int32, ByRef itemcount As Int32, ByVal splittype As OrderDetail.ProductItemDealerSplitType)
itemcount += 1
linecount += 100
Dim od As New OrderDetail(linecount, "ITEM" & itemcount.ToString, splittype)
m_OrderDetails.Add(od)
linecount += 100
od = New OrderDetail(linecount, String.Empty, splittype)
m_OrderDetails.Add(od)
linecount += 100
od = New OrderDetail(linecount, String.Empty, splittype)
m_OrderDetails.Add(od)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Size = New Size(350, 175)
With m_dgv
.Name = "DataGridView1"
.Location = New Point(0, 0)
.Dock = DockStyle.Fill
.AutoGenerateColumns = False
.AllowUserToAddRows = False
.AllowUserToDeleteRows = False
AddCol(m_dgv, "Line#", GridViewColumnType.TextBox, "DisplayLineNumberColumn", "DisplayLineNumber", True, DataGridViewContentAlignment.MiddleLeft, "00000")
AddCol(m_dgv, "Item", GridViewColumnType.TextBox, "ItemCodeColumn", "ItemCode", True, DataGridViewContentAlignment.MiddleLeft, "")
AddCol(m_dgv, "Split Type", GridViewColumnType.InvisibleTextBox, "SplitTypeColumn", "DealerSplitType", True, DataGridViewContentAlignment.MiddleLeft, "")
.DataSource = m_OrderDetails
End With
Me.Controls.Add(m_dgv)
m_dgv.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells)
AddHandler m_dgv.CellFormatting, AddressOf DataGridView1_CellFormatting
End Sub
Private Sub AddCol(ByVal grid As DataGridView, ByVal headertext As String, ByVal columntype As GridViewColumnType, ByVal name As String, ByVal propertyname As String, ByVal protect As Boolean, ByVal align As Windows.Forms.DataGridViewContentAlignment, ByVal format As String)
Dim newcol As DataGridViewColumn
Select Case columntype
Case GridViewColumnType.InvisibleTextBox
newcol = New InvisibleTextBoxColumn
Case Else
newcol = New DataGridViewTextBoxColumn
End Select
newcol.Name = name
newcol.DataPropertyName = propertyname
newcol.HeaderText = headertext
newcol.ReadOnly = protect
newcol.DefaultCellStyle.Alignment = align
newcol.DefaultCellStyle.Format = format
grid.Columns.Add(newcol)
End Sub
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs)
If e.ColumnIndex <> m_dgv.Columns.Item("SplitTypeColumn").Index Then
Exit Sub
End If
Dim invtextbox As InvisibleTextBoxCell = CType(m_dgv.Item(e.ColumnIndex, e.RowIndex), InvisibleTextBoxCell)
invtextbox.Invisible = (m_dgv.Item("ItemCodeColumn", e.RowIndex).Value.ToString = String.Empty)
Dim sb As New System.Text.StringBuilder
sb.Append("CellFormat: ")
sb.Append(m_dgv.Item("DisplayLineNumberColumn", e.RowIndex).Value.ToString)
sb.Append(" ")
sb.Append(m_dgv.Item("ItemCodeColumn", e.RowIndex).Value.ToString)
sb.Append(" ")
sb.Append(invtextbox.Instance.ToString)
sb.Append(" ")
sb.Append(invtextbox.Invisible.ToString)
Debug.Print(sb.ToString)
End Sub
End Class
Public Class OrderDetail
Private m_DisplayLineNumber As Int32
Private m_ItemCode As String
Private m_DealerSplitType As ProductItemDealerSplitType
Public Enum ProductItemDealerSplitType
Percent = 0
Dollars = 1
ItemCodes = 2
End Enum
Public Sub New(ByVal displaylinenumber As Int32, ByVal itemcode As String, ByVal dealersplittype As ProductItemDealerSplitType)
m_DisplayLineNumber = displaylinenumber
m_ItemCode = itemcode
m_DealerSplitType = dealersplittype
End Sub
Public ReadOnly Property DealerSplitType() As ProductItemDealerSplitType
Get
Return m_DealerSplitType
End Get
End Property
Public ReadOnly Property DisplayLineNumber() As Int32
Get
Return m_DisplayLineNumber
End Get
End Property
Public ReadOnly Property ItemCode() As String
Get
Return m_ItemCode
End Get
End Property
End Class
Public Class InvisibleTextBoxCell
Inherits Windows.Forms.DataGridViewTextBoxCell
Private InvisibleValue As Boolean
Private InstanceValue As Int32
Public Property Instance() As Int32
Get
Return Me.InstanceValue
End Get
Set(ByVal value As Int32)
Me.InstanceValue = value
End Set
End Property
Public Property Invisible() As Boolean
Get
Return Me.InvisibleValue
End Get
Set(ByVal value As Boolean)
Me.InvisibleValue = value
If Me.DataGridView IsNot Nothing Then
If Me.DataGridView.ReadOnly OrElse _
Me.DataGridView.Rows.Item(Me.RowIndex).ReadOnly OrElse _
Me.DataGridView.Columns.Item(Me.ColumnIndex).ReadOnly Then
Else
Me.ReadOnly = value
End If
End If
End Set
End Property
Public Overrides Function Clone() As Object
Dim Cell As InvisibleTextBoxCell = CType(MyBase.Clone(), InvisibleTextBoxCell)
Cell.Invisible = Me.Invisible
LastInstanceId += 1
Cell.Instance = LastInstanceId
Return Cell
End Function
Public Sub New()
MyBase.New()
Me.InvisibleValue = False
LastInstanceId += 1
Me.InstanceValue = LastInstanceId
End Sub
Protected Overrides Sub Paint(ByVal graphics As Drawing.Graphics, ByVal clipBounds As Drawing.Rectangle, ByVal cellBounds As Drawing.Rectangle, ByVal rowIndex As Integer, ByVal elementState As Windows.Forms.DataGridViewElementStates, ByVal value As Object, ByVal formattedValue As Object, ByVal errorText As String, ByVal cellStyle As Windows.Forms.DataGridViewCellStyle, ByVal advancedBorderStyle As Windows.Forms.DataGridViewAdvancedBorderStyle, ByVal paintParts As Windows.Forms.DataGridViewPaintParts)
Dim sb As New System.Text.StringBuilder
sb.Append("InvTxtPaint: ")
sb.Append(MyBase.DataGridView.Rows.Item(rowIndex).Cells.Item("DisplayLineNumberColumn").Value.ToString())
sb.Append(" ")
sb.Append(MyBase.DataGridView.Rows.Item(rowIndex).Cells.Item("ItemCodeColumn").Value.ToString())
sb.Append(" ")
sb.Append(Me.InstanceValue.ToString)
sb.Append(" ")
sb.Append(Me.InvisibleValue.ToString.ToUpper)
Debug.Print(sb.ToString)
If Me.InvisibleValue Then
' The textbox cell is invisible, so paint the border and background
' Draw the background of the cell, if specified.
If (paintParts And Windows.Forms.DataGridViewPaintParts.Background) = Windows.Forms.DataGridViewPaintParts.Background Then
Dim cellBackground As New Drawing.SolidBrush(cellStyle.BackColor)
graphics.FillRectangle(cellBackground, cellBounds)
cellBackground.Dispose()
End If
' Draw the cell borders, if specified.
If (paintParts And Windows.Forms.DataGridViewPaintParts.Border) = Windows.Forms.DataGridViewPaintParts.Border Then
PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle)
End If
Else
' The textbox cell is not invisible, so let the base class handle the painting.
MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts)
End If
End Sub
End Class
Public Class InvisibleTextBoxColumn
Inherits Windows.Forms.DataGridViewTextBoxColumn
Public Sub New()
Me.CellTemplate = New InvisibleTextBoxCell()
End Sub
End Class
The only other code is a Public variable called LastInstanceId in a module file so that I could generate an identifier for each created Custom Cell.
Structurally I am binding the grid to a Generic.List of Custom Business Objects. I believe there is enough evidence here that something very unusual is going on but I can't imagine what some of the answers might lead to.
As the form is first loaded, the grid appears entirely correct and the following Output messages are produced:
CellFormat: 100 ITEM1 3 False
InvTxtPaint: 100 ITEM1 3 FALSE
CellFormat: 200 7 True
InvTxtPaint: 200 5 FALSE
CellFormat: 300 9 True
InvTxtPaint: 300 5 FALSE
CellFormat: 400 ITEM2 11 False
InvTxtPaint: 400 ITEM2 5 FALSE
CellFormat: 500 13 True
InvTxtPaint: 500 5 FALSE
CellFormat: 600 15 True
InvTxtPaint: 600 5 FALSE
CellFormat: 100 ITEM1 3 False
InvTxtPaint: 100 ITEM1 3 FALSE
CellFormat: 200 7 True
InvTxtPaint: 200 7 TRUE
CellFormat: 300 9 True
InvTxtPaint: 300 9 TRUE
CellFormat: 400 ITEM2 11 False
InvTxtPaint: 400 ITEM2 11 FALSE
CellFormat: 500 13 True
InvTxtPaint: 500 13 TRUE
CellFormat: 600 15 True
InvTxtPaint: 600 15 TRUE
Scrolling down one line at a time works correctly but clicking below the scrollbar handle to cause an entire page at a time produces the following Output:
CellFormat: 600 15 True
InvTxtPaint: 600 15 TRUE
CellFormat: 700 ITEM3 17 False
InvTxtPaint: 700 ITEM3 5 FALSE
CellFormat: 800 19 True
InvTxtPaint: 800 5 FALSE
CellFormat: 900 21 True
InvTxtPaint: 900 5 FALSE
CellFormat: 1000 ITEM4 23 False
InvTxtPaint: 1000 ITEM4 5 FALSE
CellFormat: 1100 25 True
InvTxtPaint: 1100 5 FALSE
The InstanceId's and Invisible properties are totally out of control starting with line 700.
So, my questions go something like this:
Why does a Custom Cell have to have a Clone method at all and how is functionally used?
Why would there ever be 2 instances of the same Custom Cell at the same point in time?
Where are all of the 'missing' InstanceId's?
Why isn't the Paint method inside the Custom Cell class getting the same instance that was just immediately processed by the CellFormatting event?
When I intentionally avoid interacting directly with the form and I move some other window in front of it and away again, the resulting repaint is again entirely correct without any of the InstanceId 'problems'. Why?
When I decided to do this as a learning experience, I didn't know how much I was going to need to understand.
Then again, there could just be a bug somewhere in this code that I can't see because I have been looking at it for too long.
Thank you in advance for any insights and your time.
|
|
|
|
|
I do not read whole your question. But by reading some lines what I got is
that you need to make visibility true or false for particular column of DataGrid based
on some condition or data change in particular row of the same grid.
Find following code useful for the same.
dataGridView1.Columns["column_name"/column_number].Visible = false/true;
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
String str=dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I'm sorry that you feel the need to reply to messages without reading them.
As I said, I've had a lot of unsuccessful testing with various methods of accomplishing dynamic visibility of cells.
Your suggestion is just one of a half dozen that I already desperately tried.
It does NOT work. It hides an entire column.
I really need an answer to my current situation for which I believe I have provided an entire independent functioning example.
|
|
|
|
|
Hi, I need help with my report
I have created 2 tables:
Table1:
>>Datasource: Datasource1
>>Dataset: ReportItemLevelDetail1
Its grouped by category:
CategoryGroup1, expression =Fields!CategoryName.Value
The field creates a running value of =Sum(Fields!ActualCost.Value,"CategoryGroup1")
Table2:
>>Datasource: Datasource2
>>Dataset: ReportItemLevelDetail2
Its grouped by category:
CategoryGroup1, expression =Fields!CategoryName.Value
The field creates a running value of =Sum(Fields!ActualCost.Value,"CategoryGroup2")
Both create the same data but at different time periods I need to make a table3 and with
The difference between =Sum(Fields!ActualCost.Value,"CategoryGroup1") and =Sum(Fields!ActualCost.Value,"CategoryGroup2")
|
|
|
|
|
o0romeo0o wrote: I need help with my report
Who is the creator of the report object? This sounds more like a question for them.
The mind is like a parachute. It doesn’t work unless it’s open.
|
|
|
|
|
Hi guys,
Just a quick question -
I have a Windows Form (C#) with a WCF reference built on VS 2008, Windows 7.
Everything works ok. The form connects to the service, gets the data I need, and outputs it to the form.
Once I deploy/move the application to a Windows XP Pro machine - nothing works!
I have 3.5, 3.0 and 2.0 frameworks installed with all the updates.
Has anyone had a similar issue before? Or knows what could be going wrong? Perhaps I need to release the app with all references inbuilt?
Thanks for your help!
Xav.
|
|
|
|
|
xavier9999 wrote: Once I deploy/move the application to a Windows XP Pro machine - nothing works!
That's way too vague.
- Did you get an exception? You're not swallowing those, are you?
- Checked the EventLog for details?
- Does it 'try' to launch the executable, or does it even refuse to load? (Does the mouse-cursor change?)
- You mentioned that three frameworks being present, what framework is the project using?
- Verified that DEP is off? Right-click the executable and open the properties, might say something like "blocked".
I are Troll
|
|
|
|
|
xavier9999 wrote: nothing works!
Do you get some errors?
Specify them here and someone might be able to help you.
|
|
|
|
|
Hi,
Try installing "ASimpleProjectSetup"
This utility helps Windows display the apps developed in .NET.
You can download it from Microsoft website.
If case you cannot find any link for this, search for the .NET framework setup and you will see a link for "ASimpleProjectSetup" at the bottom of the page.
Please tell me whether this solution works or not.
|
|
|
|
|
How can i save values from datagridview to database
|
|
|
|
|
|
By little googling[^], see what I found.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
hi,
I want to bind a bool property of my class to the "Enabled" property of a control, but when I change my bool property, the enabled state of my control isn't changing, here an example
<br />
private bool boolValue = false;<br />
public bool BoolValue<br />
{<br />
get { return boolValue; }<br />
set { boolValue = value; }<br />
}<br />
<br />
button1.DataBindings.Add("Enabled", this, "BoolValue", false, DataSourceUpdateMode.OnPropertyChanged);<br />
<br />
BoolValue = true;<br />
How can I solve this problem?
Regards,
timm
|
|
|
|
|
The "DataSourceUpdateMode.OnPropertyChanged" is a flag that sends button1's "Enabled" value to the current record's "BoolValue" field.
It does not tell the datasource to send updates to the control.
What you need to do is force the binding context of the button to update it's index. This will cause: button1 to read the changed value.
The mind is like a parachute. It doesn’t work unless it’s open.
|
|
|
|
|
|
Hi
I am using dataset control for crystal reports inside the dataset i type tables and then pass it to thte crystal report.
Using this way i have a feeling that if i have 300 reports the dataset control will definately become heavy and the application will get slow.
My question is:
1) Is there any other way of doing it using untyped data set without using the typed dataset?
2) Is there a way i can use it without a dataset control?
Regards
|
|
|
|
|
You can "pull" data directly from source without using needing to use dataset.
You should only passing the datatables that are needed for each report, so whether 3 or 300 reports it should not matter, unless you are talking about generating 300 reports all at once.
|
|
|
|
|
you are right but what i want to do here is:
1) Not to use the dataset control in which i create tables for each report.
if i create a datatable it is not accepting to through values in the crystalreport datasource.
However all the columns are the same on both sides.
|
|
|
|
|
You're near bankrupt, aren't you? I can tell by the way that you're trying to save money on advertising
I are Troll
|
|
|
|
|
Please read this[^] guideline before you post anything in the thread.
If you want to put any product world wide then post the article in
"Product Showcase" section of code project.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
You are not even on the right website(forget the forum).
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|