How do I … modify the appearance of a Windows.Forms.TableLayoutPanel at run-time

http://social.msdn.microsoft.com/Forums/en-US/vbpowerpacks/thread/ad57487d-d7e0-4131-a388-cc3815809033/

The following adjusts the column width

Me.TableLayoutPanel1.ColumnStyles(0).Width = 10.0

The following gets the actual control. Making this invisible, leaves the table cell in place, same size.

Me.LayoutPanelGraph.GetControlFromPosition(colIndex, rowIndex).Visible = False

In my own code this is seen in SRS.Windows.Forms.ListBoxFilter

Get SQL table space – and store for KPI over time

See http://therightstuff.de/CommentView,guid,df930155-f60f-4f56-ab33-f1352ff091a1.aspx

For a single table

EXEC sp_spaceused ‘<schema>.<tablename>’

For database size

–See sql file for dbo.TableSpaceUsed
SET NOCOUNT ON DBCC UPDATEUSAGE(0) — DB size.
EXEC sp_spaceused– Table row counts and sizes.

For all tables

See http://codebetter.com/raymondlewallen/2005/03/25/using-sp_msforeachtable/
http://wp.me/p17IS4-ge

CREATE TABLE #t
(
[name] NVARCHAR(128)
,    [rows] CHAR(11)
,    reserved VARCHAR(18)
,     data VARCHAR(18)
,     index_size VARCHAR(18)
,    unused VARCHAR(18)
)

INSERT #t EXEC sp_msForEachTable ‘EXEC sp_spaceused ”?”’

–Optional, but I am now using a table I have created for storing this table size over time
DECLARE @SpoolID int SELECT @SpoolID =ISNULL((SELECTMAX(SpoolID)FROM dbo.TableSpaceUsed), 0)+ 1
–SELECT @SpoolID

INSERT INTO dbo.TableSpaceUsed (SpoolID, [name], [rows], reserved, reservedText, data, index_size, unused)
SELECT @SpoolID, name,rows,CAST(REPLACE(reserved,‘KB’,)ASint)AS reserved, reserved AS reservedText, data, index_size, unused
FROM  #t

SELECT * FROM #t ORDER BY CAST(REPLACE(reserved,‘KB’,)AS int) DESC— # of rows.

SELECT SUM(CAST([rows] ASint))AS [rows] FROM #t

DROP TABLE #t

Using sp_MSforeachtable

http://codebetter.com/raymondlewallen/2005/03/25/using-sp_msforeachtable/

See usage in http://wp.me/p17IS4-gc

How do I hide missing data values in DataVisualization.Charting.Chart e.g. Saturdays and Sundays

 

If data is missing for say days of weekend then the chart will by default still include these dates in the X values so there will be a not pretty gap. This can be corrected with:

Series.IsXValueIndexed = True

How do I set the DataVisualization.Charting.Chart Column Gap

The column gap is set on the:

Chart > Series > Misc > Point Width – default = 0.8 for no gap use 1

DataVisualization.Charting Cursors, Zooming, and Scrolling (Chart Controls)

 

I like the Zooming and Scrolling features of these Charts but find it difficult to find in the Chart Control. It is at:

Chart Areas > CursorX >

IsUserEnabled = True
IsUserSelectionEnabled = True

http://msdn.microsoft.com/en-us/library/dd456730

 

 

Click-Once – The application binding data format is invalid

 

Remove files from %userprofile%\AppData\Local\Apps\2.0\

LINQ and Entity Framework with DbContext – Convert Anonymous type to Strongly Typed – Bind to ListBox

[ Personally I have a sample of this in EFSample1.sln ]
To convert anonymous type to strongly typed, you can add a class that does what you want, then Select New … with {.ID = …}
This allows you to say get data from more than one table and still have a strongly typed output. Will not be updateable.

To fill a ListBox use

Imports System.Linq ‘if namespace not already imported

See http://wp.me/p17IS4-9S

Dim result = …GetEmployees
ListBox.DataSource = result.ToList

To save on setting the DisplayMember use .ToString in the class

Public Class EmployeeList
Property ID As Integer
Property FullName As String

Overrides Function ToString() As String
Return FullName
End Function

End Class

Public Class EmployeeEF

Private context As New EFWinFormsDBContext.TestEFIEntities

Function GetEmployees() As System.Linq.IQueryable(Of EmployeeList)

Dim result = From emp As Employee In context.Employees Join con As Contact In context.Contacts On emp.EmployeeID Equals con.ID Order By con.FullName
Select New EmployeeList With {.ID = emp.EmployeeID, .FullName = con.FullName}

Return result

End Function

End Class

Forms-Based Authentication with SQL Azure

 

Following is quite useful

http://msdn.microsoft.com/en-us/library/windowsazure/hh508981.aspx

I was able to get this to work without a Windows Azure Project

Worked on site. However the role manager did not wok

http://stackoverflow.com/questions/5541868/problem-with-your-selected-data-store-on-the-asp-net-website-administration-tool

Changed following and it worked
<roleManager enabled=”true”>

 

 

Deleting an ASP.Net azure hosted website using Entity Framework can potentially delete the linked database

I had a database on Azure that was being updated using Windows Forms. I then created an ASP.Net MVC application using EF to work against the same database. However I following a tutorial which used Code First

http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/

This would not publish until I used Nu-Get to:

enable-migrations

However I think I then used code first migrations on publish. However I published the website with high credentials and wanted to change the credentials to lower. Could not see how to do this in Azure, so deleted the website. At this point the database disappeared without warning.

This is why the last posts have been about SQL Azure backup. However recovered using on-site data and re-created database.

Microsoft support helped with the ASP.Net so:

enable-migrations

Check the file created, but do not check the box on publish.

Tested by deleting the Website – This then asked if you wanted to delete the linked database. Answer: No. Database stays ok.