 |

|
good day experts, i want to know how to select records per week.
example, the date from sunday to saturday wherein sunday is the satrtdate.this is my code in my form:
If ComboBox1.Text = "Central Reservation Report" Then
If RadioButton2.Text = "Weekly Report" Then
Dim det As New Date
Dim rpt As New rsvD() 'The report you created.
Dim MyCommand As New SqlCommand()
Dim myDS As New DScentralrsv() 'The DataSet you created.
Dim myDA As New SqlDataAdapter()
Dim cn As New SqlConnection(ConnectString())
Try
MyCommand.Connection = cn
MyCommand.CommandText = "Select irsno,date,industry,totalamount from maintable"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "maintable")
MyCommand.CommandText = "Select irsno from roomtbl"
myDA.Fill(myDS, "roomtbl")
myDS.EnforceConstraints = False
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End If
my reports contains a fields named,irsnum,date,industry ,totalamount where date is in a group
modified 22 hrs ago.
|
|
|
|

|
For the final course work i did program to get the computer system hardware information. But now, i want upgrade my program to a high level, what i want to do now is implement my program in a network for an office. But i dont have any ideia how can i do that can you give me some tips?
Thank you,
Daniel Jesus
|
|
|
|

|
I had to cancel registration to build 2013. Anyone interested for substituting me contact at Subrat@live.co.uk
|
|
|
|

|
hi to all
i have a serious problem in vs 2012 when i want to working with vs 2012 i face every with this error
Microsoft visual studio 2012 has encountered a problem and needs to close
vs show me this error and restart itself automatically
any one can help me
thanks in advanced
modified 11-Jun-13 14:54pm.
|
|
|
|

|
I got this error when update some text field but when update image field it success
below is the code, need help everyone
----code----update-----
Dim sConnectionString As String _
= "Persist Security Info=False;Data Source=10.10.10.60\sqlexpress;Initial Catalog=subkon;User Id=sa;Password=123"
Dim objConn As New SqlConnection(sConnectionString)
objConn.Open()
Dim sSQL As String = "UPDATE style SET style_no=@style_no, style_name=@style_name, style_po=@style_po, " & _
"style_qty=@style_qty, style_image=@style_image, style_date=@style_date WHERE style_no=@style_no"
Dim objCmd As New SqlCommand(sSQL, objConn)
With objCmd.Parameters
.AddWithValue("@style_no", style.txt_styleno.Text)
.AddWithValue("@style_name", style.txt_stylename.Text)
.AddWithValue("@style_po", style.txt_stylepo.Text)
.AddWithValue("@style_qty", style.txt_styleqty.Text)
.AddWithValue("@style_size", style.txt_stylesize.Text)
.AddWithValue("@style_date", style.DateTimePicker1.Text)
End With
Dim ms As New MemoryStream()
style.PictureBox1.BackgroundImage.Save(ms, style.PictureBox1.BackgroundImage.RawFormat)
Dim data As Byte() = ms.GetBuffer()
Dim p As New SqlParameter("@style_image", SqlDbType.Image)
p.Value = data
objCmd.Parameters.Add(p)
' objCmd.ExecuteNonQuery()
MessageBox.Show("Added success", "Save", MessageBoxButtons.OK)
Try
objCmd.ExecuteNonQuery()
Catch e As Exception
Console.WriteLine(e.Message)
End Try
Console.WriteLine("Record Added")
objConn.Close()
-----end code-----
|
|
|
|

|
I searched on internet for creating Setup of a project. I found that "The setup project is abandoned in VS 2012."
My question is:- is there any way to create Setup of my project in VS 2012?
Thanks in Advanced ....
|
|
|
|

|
i want to convert arabic speech to text
|
|
|
|

|
I have an image element added to the report. I added the dataset and filled it on the form with the reportviewer control. The report and its datasource are correct.
I set the image to the correct datafield and selected jpeg for the type. However, I know that I am missing something when it comes to pulling the image from the database - it was saved as a varbinary(max) because I was afraid to use image with all of the talk of this type being "done away with" in the future.
I can pull the image to a picturebox on the form and load it with the following code ...
cu = (From tbl In context.refCompanyUsers Select tbl).Single
Dim img = cu.StampLogo
LogoPictureBox.Image = ConvertBinaryToImage(img.ToArray())
I know I need to do something similar to show the image on the report, but all of my MS and Google searches do not return how to directly use the code or parameter in some such manner to display this needed element.
I hate that I have to say it, but I do not know how. And, to make matters worse, I can't find it myself in the knowledge base, which is usualy never a problem.
More to add:
I have written the custom code for the report:
<Code>
Public Function ConvertImageByte(ByVal img As Byte()) as System.Drawing.Bitmap
Dim picStream As System.IO.MemoryStream
Dim logo As System.Drawing.Bitmap =
New System.Drawing.Bitmap(System.Drawing.Image.FromStream(picStream))
Return logo
End Function
</Code>
I use this in the picture box on the report designer:
Code.ConvertImageByte(system.Convert.ChangeType((First(Fields!StampLogo.Value, "CompanyUserDataSet")),GetType(Byte())))
The "ConvertImageByte" has the red, wavy error line under it.
While I have made some progress. I still have no image. The last bit of code is my latest attempt at using a stream reader versus converting or casting.
modified 6-Jun-13 9:13am.
|
|
|
|

|
I am using VS2010 so I hope it's alright that I post my question in this forum.
I have a winforms app that I am trying to be able to print an RDLC report with subreports directly to the printer from the push of a button.
I have the code from this link http://msdn.microsoft.com/en-us/library/ms252091%28v=vs.100%29.aspx that allows me to print directly to the printer but I can't figure out how to get it to work when the report has subreports. Everything I have researched shows examples for printing subreports using the reportviewer which I am not using. I need to be able to print directly to the printer.
Can anyone help? I've been stuck on this for months.
Thanks,
Stacy
|
|
|
|

|
| Hi, I have created a project in C#.net windows application, The Program.cs file contains two classes named as Program and Option, So my project properties contains two startup object one is windows.Program and other is windows.Options. The code has been run successfully, When i choose startup object as windows.Options then my code has starts to run from windows.Options class and if i choose windows.Program, it starts to run Program class. I need to create a installation package in my project and after installation has been done, my project has to display in start menu. I can create a Installation package and installation also done. Note:The problem is the installation package runs only one startup object. i.e. before create installer, I suppose to choose startup object as "windows.Program" then after create installer and installed successfully then click my installed project, It directly run the windows.Program file. If I suppose to choose "windows.Options" before create installer. then after installation of my project and run means it starts to run windows.Options class.I need to create a single installation package and after installed this package, my project needs to shown in start menu of my system name called "project" and when i click project, it has to show both Program and options. If i choose Program, then it starts to run program part of my project, if I choose Options, then it starts to run Option part of my project. If you know guide me how to create package like this.
|
|
|
|
 |
Message Automatically Removed
|
|
|
|

|
I have a Form View has a text field in the , the text field binded to a 2 way binded control, code as follow:
<td class="table-4">
<asp:TextBox ID="txtDOB" runat="server" Text=</td>
and I'm using TextMode as Date which will result in displaying the calender in the browser.
in the Model Entity class I'm defining the DOB as:
<Display(Name:="Date of Birth"), DataType(DataType.DateTime), DisplayFormat(ApplyFormatInEditMode:=True, DataFormatString:="{0:yyyy-MM-dd}")>
Public Property DOB() As Date?
The problem: When using Google Chrome or Opera which they are excellent in handling & compatible with HTML5 elements, the txtDOB field doesn't show the date data value which binded from the db, what displayed instead is: 1- in Chrome, displays yyyy-mm-dd, which is the date format iam using 2- in Opera, the txtbox is empty.
Both browsers displays the calendar when clicked on the field.
Why the bounded date data not shown in the text field also not marked/selected when the calendar opened?
Note: in IE I see it as normat txtField with the date value binded from the db, of course no calendar view coz IE ver 9 doesn't support fully HTML5 which results to not understand the tag (TextMode="Date")
Used technology: - VS 2012 - Entity Framework 4.5
Thanks for the help in advance
|
|
|
|

|
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
cryRpt.Load("C:\Users\Frontliner0102\Desktop\newRSVSYSTEM\ReservationSys\ReservationSys\ReservationSys\orderrpt.rpt")
With crConnectionInfo
.ServerName = "192.168.1.20"
.DatabaseName = "irsDB"
.UserID = "hposAdmin"
.Password = "1zones"
End With
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
when i try to run the program and do the food ordering, there is an error that pops out on my code saying that can't load the report/report unhandled.what should i do?
|
|
|
|

|
Hi.
My computer HD died and I reinstalled VC2008. Before I have multibyte char (in other language) showing correctly in my files etc. they are for different language setting I have for labels etc. Now for some reason, in files that have these characters, the characters are not displayed right and is jibeerish. But when compiled the characters still is shown right on screen. I was just wondering if maybe some setting is not right so that it is shown not correctly in the foreign characters?
Thanks.
Stan the man...
|
|
|
|

|
Hi.
How i use in code behind, files i saved in the Resources folder in the solution explorer?
I have a solution called Editor and i want user a .xls file.
Thanks.
modified 19-May-13 4:19am.
|
|
|
|

|
Hi,
Is this the correct forum for SQL Database queeries? If not, could you point me in the right direction.
We sell a product, best described as a set of Cash Registers, with a common database. Our current product contains a proprietory database system. We propose for our next major version to use SQL. We face two problems.:
1.
the data base needs to be primed with certain default values, such as an administrator account,
and basic security classes.
2.
How do I create 'At Design Time' template that will run when the server is installed
Bram van Kampen
|
|
|
|

|
Hi
i am using fastreport.net 1.9 (2 and 4) in visual studio 2012 for target framework 3.5 . but when i want build project ,build fail with this error:
"The type or namespace name 'Report' does not exist in the namespace 'FastReport' (are you missing an assembly reference?)"
when i use framework 4 , it will build successfully.
i just use visual studio 2012 (for using tfs 2012) and target framework 3.5 .
(my os is windows 7)
thanks
i found the solution! just download
"System.Windows.Forms.DataVisualization, Version=3.5.0.0"
from
http://www.microsoft.com/en-us/download/details.aspx?id=14422.
thanks
modified 19-May-13 4:33am.
|
|
|
|

|
I need to generate a PDF report which contains some images, costume text info, and a table from my ASP.net MVC3 application. please give me any ideas on the best way to implement this?
|
|
|
|
|

|
Am facing few problems pls do help me
i have dll that i need to call in VB.Net even tht dll company has given sample code in vb6 but am doing in vb10
Private Sub capture1_Click(sender As System.Object, e As System.EventArgs) Handles capture1.Click
Dim pszFileName As String
Dim lRetStatus As Integer
Dim lWidth As Integer
Dim lHeight As Integer
Dim lImageSize As Integer
Dim lFrameBytes As Integer
Dim lBitSize As Integer
Dim DLLCallReturnValue As Integer = 0
Call DcamInitialize()
Call DcamOpen()
Call DcamSetDriveMode(DCAM_CCDDRVMODE_STANDBY, 3000)
Call ConnectionDevice(pState)
Call DcamSetGain(1)
Call DcamSetOffset(10)
Call DcamSetBinning(DCAM_BINNING_1X1)
Call DcamSetCCDType(DCAM_CCD_TYPE0)
Call DcamSetTriggerPolarity(DCAM_TRIGPOL_NEGATIVE)
Call DcamSetTriggerMode(DCAM_TRIGMODE_EXT_LEVEL2)
Call DcamGetBitPerPixel(lBitSize)
Call DcamGetImageSize(lWidth, lHeight)
lImageSize = lWidth * lHeight
Dim BufferSizeInBytes As Integer = lImageSize * 2
Call DcamGetFrameBytes(lFrameBytes)
lRetStatus = DCAM_WAITSTATUS_UNCOMPLETED
ReDim Preserve CorrectedImageBuffer(lImageSize - 1)
Call DcamCapture(CorrectedImageBuffer(0), lImageSize * 2)
Do
Call DcamWait(lRetStatus, nTimeout)
If lRetStatus = DCAM_WAITSTATUS_COMPLETED Then
Exit Do
End If
Loop
If lRetStatus = DCAM_WAITSTATUS_COMPLETED Then
Dim oFileStream As System.IO.FileStream
oFileStream = New System.IO.FileStream("D:\CorrectedImage.tiff", FileMode.Create)
oFileStream.Write(CorrectedImageBuffer, 0, lImageSize)
oFileStream.Close()
pszFileName = "D:\simple2.tiff"
Dim Mystream As New FileStream("D:\simple2.tiff", FileMode.Open)
Mystream.Read(CorrectedImageBuffer, 0, lImageSize)
Call DcamImgTiffGetInfo(pszFileName, lWidth, lHeight, 16, lBitSize)
Call DcamImgTiffLoad(pszFileName, CorrectedImageBuffer(0), lImageSize)
Call DcamImgTiffSave(pszFileName, CorrectedImageBuffer(0), lWidth, lHeight, 16, lBitSize)
Form2.Show()
Form2.BringToFront()
Else
Call MsgBox("Error Capture", vbCritical)
End If
End Sub
Am getting all values
Image width=1500
image hiegt=1000
nbitssize=12
but am getting wrong buffer size i.e, 97 am getting at CorrectedImageBuffer(0)=97
|
|
|
|

|
I am interested in knowing how do I compile a DLL so that it cannot be examined in a tool like .NET Reflector.
I am developing some robots for various FX trading strategies and would like to compile them in such a way that the entry and exit strategy remains private so if I sell them they cannot be reverse engineered.
I vaguely remember reading about how to accomplish this a long time ago but do not remember what the procedure is.
If anyone knows how to accomplish this please let me know.
|
|
|
|

|
Dear All,
I have 6 tables created from a class using EF Code First approach, and I'm wondering how to do the relationship between the tables using DataAnnotation, classes as follow:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Public Class Customer
<Key, ScaffoldColumn(False)>
Public Property CustomerID() As Integer
<Display(Name:="File No"), StringLength(6)>
Public Property CustomerFileNo() As String
<Required(ErrorMessage:="First Name is required")>
<Display(Name:="First Name"), StringLength(20)>
Public Property FirstName() As String
<Display(Name:="Last Name"), StringLength(20)>
Public Property LastName() As String
<Display(Name:="Street"), StringLength(40)>
Public Property Addr_StreetName() As String
<DefaultSettingValue("0")>
Public Property MaritalStatusID() As Integer
<DefaultSettingValue("0")>
Public Property Addr_AreaID() As Integer
<DefaultSettingValue("0")>
Public Property Wrk_OccupationID() As Integer
End Class
Public Class MaritalStatus
<Key, ScaffoldColumn(False)>
Public Property MaritalStatusID() As Integer
<Required(ErrorMessage:="Name Required")>
<Display(Name:="Marital Status"), StringLength(10)>
Public Property MaritalName() As String
<DefaultSettingValue("1")>
Public Property RecStatus() As Boolean
End Class
Public Class Area
<Key, ScaffoldColumn(False)>
Public Property AreaID() As Integer
<Required(ErrorMessage:="Name Required")>
<Display(Name:="Area Name"), StringLength(30)>
Public Property AreaName() As String
<DefaultSettingValue("1")>
Public Property RecStatus() As Boolean
End Class
Public Class Occupation
<Key, ScaffoldColumn(False)>
Public Property OccupationID() As Integer
Public Property OccupationName() As String
End Class
Public Class InvoiceHdr
<Key, ScaffoldColumn(False)>
Public Property InvoiceID() As Integer
Public Property InvoiceNo() As String
Public Property Amount() As Integer
Public Property CustomerID As Integer
End Class
Public Class InvoiceDetails
<Key, ScaffoldColumn(False)>
Public Property InvoiceDetailsID() As Integer
Public Property InvoiceID() As String
Public Property ItemNo() As String
Public Property ItemDescription() As String
End Class
Description:
Customer table has fields:
- MaritalStatusID which linked to MaritalStatus master table
- Addr_AreaID which linked to Area master table
- Wrk_OccupationID which linked to Occupation master table
Then Invoice table has:
- CustomerID which linked to the customer table
Then InvoiceDetails table has:
- InvoiceID which is linked to Invoice table.
modified 18-Apr-13 12:40pm.
|
|
|
|

|
Hi,
I have installed VS2012 Express for the Web, and am trying to get the SQL server going. The SQL Server looks for IIS on my Machine, which, so it maintains, is not installed on it. At the same time, 'Test-launching' webpages in VS2012 works fine, so 'Something' is serving them. (I assume that IIS and SQL came with VS2012 express as part of the installation)
Any idea what's going on?
Bram van Kampen
|
|
|
|

|
Hi,
I'm using a FormView and update method which try to update the database, but it's throwing and error, I need to know on which field the error was but I am not able to extract the error msg from the ModelStateDictionary so I can know what is the exact error msg, the code as follow:
Public Function UpdateTest(id As Integer) As Integer
Dim Employee = _db.DbSet_Employees.Find(id)
Try
If Employee Is Nothing Then
ModelState.AddModelError("ModelError", String.Format("Employee with ID {0} could not be found", id))
Return 0
End If
TryUpdateModel(Employee)
If Not ModelState.IsValid Then
ModelState.AddModelError("ModelError", String.Format("Employee with ID {0} could not be updated", id))
MsgBox(ModelState.GetErrorMessageForKey("error"))
Return 0
End If
Catch ex As Exception
Me.lblMsg2.Text = ex.Message.ToString
Return 0
End Try
Return _db.SaveChanges
End Function
Public Module ExtMethod
<System.Runtime.CompilerServices.Extension> _
Public Function GetErrorMessageForKey(ByVal dictionary As ModelStateDictionary, ByVal key As String) As String
Return dictionary(key).Errors.First().ErrorMessage
End Function
End Module
The problem start from TryUpdateModel then in the temperrory line MsgBox()
Thanks for the help.
|
|
|
|

|
I have an app that needs to check the blocked website list before making a request in order to avoid the pop-up toast message, which can be really annoying if the user can't control the app's underlying request. The MSDN documentation is vague, but references a sample app in the SDK, which I haven't been able to find. Does anyone know if the blocked/allowed website lists can be obtained programmatically?
QRZ? de WAØTTN
|
|
|
|

|
Dear All,
I wrote my db classes then created a web form and added GridView to list all the raws from the Employee table which works fine using the below method/code:
WebForm page code:
GridView runat="server" ID="vgEmployees" PageSize="5" Width="100%" ItemType="TestApp.Employee"
DataKeyNames="ID" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
SelectMethod="GetEmployees"
WebForm Code behind:
Private ReadOnly _db As New TestAppDbContext
Public Function GetEmployees() As IQueryable(Of Employee)
Return _db.DbSet_Employees
End Function
All above work perfectly, now added a search form where it takes input from the user they query the db and return only the results & display it same gridview, (say):
Enter data to search for:
Employee Name: ............
Employee Dept: ......
[Search]
The Question:
How to query the database using Entity to SQL? and is E2S good enough or should move to L2E?
Thanks for you help.
|
|
|
|

|
I have an Excel Template (developed under .Net4.0) deployed in a mapped driver the problem is that some computer can run the vsto but other prompt an error message
"Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: La personnalisation n'a pas les autorisations requises pour créer un domaine d'application. ---> System.Security.SecurityException: La fonctionnalité personnalisée dans cette application ne fonctionnera pas car l'administrateur a qualifié file:///S:/MyFolder/Publish/ExcelTemplate.vsto comme étant non fiable."
All computer got a windows 7 and office 2010.
What should i do to make the vsto run from a mapped disk ??
Thanks for any help.
modified 4-Apr-13 8:48am.
|
|
|
|

|
i have designed a report in crystal report with group on one of my field. e.d Field1. but related data to this group starts from next line. where as i want to display it as:
GroupField1 Record1
record2
.......
|
|
|
|

|
Guys i have designed a snake and its prey,the snake is moving but it is moving in all directions(reverse also)how to move this snake correctly to catch that prey and other prey to appear.I am trying this for past 11 days but i cant solve this.help me plzzzzz..........
i have designed it in vb guys......
i have added my code below...........
modified 4-Mar-13 0:25am.
|
|
|
|

|
I am configuring CI in TFS and this is the issue i am getting
Web deployment task failed. (Connected to 'localhost' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on 'localhost'.
these are the parameters i am using in MSBuild Arguments
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MsDeployServiceUrl=http:
can anyone help
|
|
|
|

|
Thank you sir for your code,the code was successful and it is very usefull for learners.
|
|
|
|

|
Hi,
I want to find whole sentence in VS that start: <asp:Panel and end: runat="server"> and replace with div tag please help
|
|
|
|

|
guys i have tried many codes to find the processor id but i was not able to find it..............
does any one know how to code it in vb.net
help me with a code...........
plz...........
|
|
|
|

|
hey guys...
i have a problem ! when i choose CrystalReport.rpt from NewItem , it just attach a .mht file that said me go to SAP.com and download crystal report ... !
i download Crystal Report for visual Studio Runtime (32bit)&(64bit)... but it doesnt work yet and still when i want add a crystalreport.rpt , visual stuio just show me that .mht file , what should i do?
thanks all
|
|
|
|

|
Hello All,
I don't know if this is the right forum to ask my question since I have VS2008 and not VS11 but I'm going to go ahead and ask anyway. Please bear with me as this is my second attempt at creating a windows app. When I try to add a new class to my windows app I noticed that although I had given the class a name of InputValidation.cs, the name of the class within InputValidation.cs is Class1. The following code is what I see in my file:
using System;
public class Class1
{
public Class1()
{
}
}
I tried to change it but there doesn't seem to be a way to. Why is it different from adding a new class to a web app where the name of the class is what ever the programmer entered? Thanks in advance for your reply.
modified 9-Feb-13 0:18am.
|
|
|
|

|
I've developped an application in C++ with Visual studio 10.
My program need to generate a huge quantity of small object (size = 12 Kb)in memory.
I want my program to manage the memory when the process run out of memory.
So I've implement a try/catch bloc to intercept this event. Then I free the memory and I tell the user that the operation is canceled.
But it seems in this case that the virtual memory is released not.
here's the code :
#include "stdafx.h"
#include <vector>
#include "AllocationErr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
using namespace std;
void ReportMemory()
{
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
HANDLE heap = GetProcessHeap();
SIZE_T size = HeapCompact(heap, 0);
BOOL validated = HeapValidate(heap, 0, NULL);
TRACE("GlobalMemoryStatusEx:\n");
TRACE(" + TotalVirtual : %0.1lf Mo\n", statex.ullTotalVirtual / (1024.0 * 1024.0));
TRACE(" + AvailVirtual : %0.1lf Mo\n", statex.ullAvailVirtual / (1024.0 * 1024.0));
TRACE(" + Process mem load : %0.1lf %%\n", (1.0 - (double) statex.ullAvailVirtual / (double) statex.ullTotalVirtual) * 100.0);
TRACE(" + TotalPageFile : %0.1lf Mo\n", statex.ullTotalPageFile / (1024.0 * 1024.0));
TRACE(" + AvailPageFile : %0.1lf Mo\n", statex.ullAvailPageFile / (1024.0 * 1024.0));
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
TRACE("Before allocation\n");
ReportMemory();
const unsigned int taille_bloc = 10* 1024, nb_blocs_max = (3U * 1024U * 1024U * 1024U / taille_bloc);
int i = 0;
char ** p = NULL;
try
{
p = new char *[nb_blocs_max];
memset(p, 0, nb_blocs_max * sizeof(char *));
for(i = 0; i < nb_blocs_max; i++)
{
p[i] = new char[taille_bloc];
}
}
catch (CMemoryException* e)
{
e->Delete();
TRACE("After the program ran out of memory\n");
ReportMemory();
for(i = 0; i < nb_blocs_max; i++)
{
if(p[i])
{
delete [] p[i];
}
}
delete [] p;
}
TRACE("After freeing memory\n");
ReportMemory();
char * t = NULL;
try
{
const unsigned int taille_max = 30 * 1024 * 1024;
t = new char[taille_max];
}
catch (CMemoryException* e)
{
TRACE("Memory allocation failed\n");
e->Delete();
if(t)
{
delete [] t;
}
}
return 0;
}
Check the virtual available memory after the application free the memory ...
And check the next allocation of 30 Mb just after ...
Any Idea ?
Here's the result of the execution
Before allocation
GlobalMemoryStatusEx:
+ TotalVirtual : 2047.9 Mo
+ AvailVirtual : 2016.8 Mo
+ Process mem load : 1.5 %
+ TotalPageFile : 5198.6 Mo
+ AvailPageFile : 3172.9 Mo
After the program ran out of memory
GlobalMemoryStatusEx:
+ TotalVirtual : 2047.9 Mo
+ AvailVirtual : 4.5 Mo
+ Process mem load : 99.8 %
+ TotalPageFile : 5198.6 Mo
+ AvailPageFile : 1155.2 Mo
After freeing memory
GlobalMemoryStatusEx:
+ TotalVirtual : 2047.9 Mo
+ AvailVirtual : 5.7 Mo
+ Process mem load : 99.7 %
+ TotalPageFile : 5198.6 Mo
+ AvailPageFile : 3170.8 Mo
modified 8-Feb-13 6:58am.
|
|
|
|

|
Need help for cross page posting in ASP.net
|
|
|
|

|
How to Firing event when creating instance of a class in C#.net?
Do i set the event in Class Constructor?
MASTER
|
|
|
|
|

|
now i have made a on screen keyboard but how to enter the characters in to a notepad using this on screen keyboard i have tried many times to enter in to it but it was not successful.....
how to do this guys?.
i forgot to mention i have designed it in vb...
|
|
|
|

|
how to create shortcut keys using vb...
for ex:"ctrl+o" for opening...
|
|
|
|

|
I have the following simple WinRT C++/Cx code involving inherited interface, template class and public implementation:
public interface class IFoo
{
void KungFoo();
};
public interface class IBar : IFoo
{
void Snafu();
};
template <class T>
ref class TFoo : IFoo
{
public:
virtual void KungFoo() { std::cout << "TFoo.KungFoo(" << sizeof(T) << ")" << std::endl; }
};
template <class T>
ref class TBar : TFoo<int>, IBar
{
public:
virtual void Snafu() { std::cout << "TBar.Snafu(" << sizeof(T) << ")" << std::endl; }
};
public ref class FooBar : IBar
{
private:
TBar<USHORT> bar;
public:
virtual void KungFoo() { bar.KungFoo(); }
virtual void Snafu() { bar.Snafu(); }
};
When I try to compile that I got the error:
error C3766: 'TBar<T>' must provide an implementation for the interface method 'void IFoo::KungFoo(void)'
but : TBar<T> inherit from TFoo<int> which does implement the interface!!!
What is wrong? How to fix that please?
Thanks!
My programming get away... The Blog...
Taking over the world since 1371!
|
|
|
|

|
how to add a close click form events in form skinner
Regards
Andy
|
|
|
|

|
I have a C++/Cx class like so
public value struct float2
{
float x,y;
};
I'd like to add a constructor with parameter like
public value struct float2
{
float x,y;
float2(float _x, float _y);
};
and I got a compiler error. Some googling later it seems it's not possible to add a constructor to a struct.. mm... fine I guess...
Then later I was looking at
public value class Windows::Foundation::Size,
And it has a parameterized constructor!!!
Windows::Foundation::Size::Size(float w, float h)!!!
This WinRT API value class has a public constructor with parameters!! (it even implement operator overloading!)
but The best I tried I couldn't implement paremeterized constructor and operator overloading for my own value struct..
Can someone show me how to declare / implement a simple parameterized constructor (and operator overloading for '+') on my simple class above please?!!!!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|

|
can anyone help me how to create a onscreen keyboard using visual c++ please..........
|
|
|
|

|
I have a WinRT C++ component which work fine when use in C#.
(implementation below)
However, when I tried to use it in a Direct3D C++ WinRT app it crashes in the constructor, while calling
ref new PerformanceTimer()
-> Reset()
-> OnPropertyChanged("Total")
-> PropertyChanged(this, ....)
I got a "Platform::WrongThreadException ^"
What can I do?
I need those event to notify about some important change (this Total property is not important, but others are)
[Windows::UI::Xaml::Data::Bindable]
[Windows::Foundation::Metadata::WebHostHidden]
public ref class PerformanceTimer sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
PerformanceTimer()
{
Reset();
}
void Reset()
{
m_total = 0.0f;
OnPropertyChanged("Total");
}
property float Total { float get() { return m_total; } }
#pragma region INotifyPropertyChanged
private:
void OnPropertyChanged(Platform::String^ propertyName)
{
PropertyChanged(this, ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs(propertyName));
}
event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ _pChanged;
public:
virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged
{
Windows::Foundation::EventRegistrationToken add(Windows::UI::Xaml::Data::PropertyChangedEventHandler^ value)
{
return _pChanged::add(value);
}
void remove(Windows::Foundation::EventRegistrationToken token)
{
_pChanged::remove(token);
}
internal:
void raise(Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e)
{
_pChanged::raise(sender, e);
}
}
#pragma endregion
private:
LARGE_INTEGER m_frequency;
float m_total;
};
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|

|
I created a simple WinRT C++ class to help having meaningful exception, it looks like that
public enum class ErrorCodes
{
CodeStart = 0x0200, CodeEnd = CodeStart + 100, NotErrorCode = CodeEnd - 1,
StupideError1 = CodeStart + 1,
StupideError2 = CodeStart + 2,
};
public ref class Class1 sealed
{
private:
Class1() {}
public:
static void Throw(ErrorCodes c);
static ErrorCodes GetCode(Platform::Exception^ ex);
};
However, when I try to use it in C#, with code like that
try
{
Class1.Throw(ErrorCodes.StupideError1);
}
catch (Exception ex)
{
var c = Class1.GetCode(ex);
}
I got the following compiler error in my C# project:
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,5,42,8): error CS0012: The type 'Platform.Exception' is defined in an assembly that is not referenced. You must add a reference to assembly 'platform, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,13,42,31): error CS1502: The best overloaded method match for 'CppComp.Class1.GetCode(Platform.Exception)' has some invalid arguments
2>C:\Dev\W8\App1\App1\App.xaml.cs(42,28,42,30): error CS1503: Argument 1: cannot convert from 'System.Exception' to 'Platform.Exception'
How could I fix that?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|

|
I'm trying to write a C++ component that is going to be used in C#
Apparently I can't use custom exception or custom error message but it SHOULD be possible (according to the documentation) to use COMException with custom code.
well I tried to do just that, as shown in my component code below:
public enum class ErrorCodes
{
CodeStart = 0x0200, CodeEnd = CodeStart + 100,
StupideError1 = CodeStart + 1,
StupideError2 = CodeStart + 2,
};
public ref class Class1 sealed
{
public:
Class1() {}
void Throw()
{
throw ref new Platform::COMException((int)ErrorCodes::StupideError2);
}
};
Yet, when I consume that method from C# I always get an ArgumentException with and HRESULT which doesn't seems related to my code :/
How could I produce a usable COMException?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|

|
I can break and step into anonymous methods. Yet, I cannot trace lambda execution, the expression tree.
Do we still need to jump to linqPAD?
|
|
|
|
|
 |
|