|
Kevin Marois wrote: are the assemblies created during build always put in the Bin folder
By default, yes. But not mandatory.
Kevin Marois wrote: but I'm curious if they ever would.
It's configurable through the project properties build tab.
|
|
|
|
|
Hi All,
I am getting following error when I am trying to assign a null value or nuthing value to a variable of type Nullable(Of Decimal).
But for that variable I want to assign a decimal value or null value. The same kind of problem I faced with Nullable (of DateTime) too. It cant take a nothing assigned to it. If it cant take that value then why is it nullable(of Decimal) or Nullable (of DateTime) and System.Nullable(Of Integer) is also not taking null values (means nothing value in VB.Net).
Please help me in resolving this issue.
thanks in advance.
Below is my code: I tried by just putting variable=nothing also but didnt work.
If savRequestData.PropRequestWage IsNot Nothing Then
wagesegment = New List(Of ReqWage)
For Each temp In savRequestData.PropRequestWage
Dim wage As New ReqWage
wage.DailyWage = IIf(Not String.IsNullOrEmpty(temp.DailyWage), IIf(Decimal.TryParse(temp.DailyWage, tempDecimal), tempDecimal, CType(Nothing, System.Nullable(Of Decimal))), CType(Nothing, System.Nullable(Of Decimal)))
wage.RequestId = request_Id
wage.WorkDate = temp.WorkDate
wage.WorkHours = IIf(Not String.IsNullOrEmpty(temp.WorkHours), IIf(Decimal.TryParse(temp.WorkHours, tempDecimal), tempDecimal, CType(Nothing, System.Nullable(Of Decimal))), CType(Nothing, System.Nullable(Of Decimal)))
wagesegment.Add(wage)
requestedamount += IIf(temp.DailyWage IsNot Nothing, temp.DailyWage, 0)
Next
End If
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Sub Main()
Dim d As Nullable(Of Integer)
d = Nothing
Console.WriteLine("d=", d)
Console.ReadKey()
End Sub
Works fine for me. However, the line
wage.WorkHours = IIf(Not String.IsNullOrEmpty(temp.WorkHours), IIf(Decimal.TryParse(temp.WorkHours, tempDecimal), tempDecimal, CType(Nothing, System.Nullable(Of Decimal))), CType(Nothing, System.Nullable(Of Decimal)))
..is something I'd delete during a code-review. It's doing to much on a single line, making debugging harder. It's not C++, and there's no shame in using a line per statement.
|
|
|
|
|
Of course. Here is an alternate use of indirect access to textbox strings. Any suggestions?
static public int boxCount = 0;
static public TextBox[] tbox = new TextBox[16];
private void Form1_Load(object sender, EventArgs e)
{
tbox[0] = textBox1;
tbox[1] = textBox2;
tbox[2] = textBox3;
boxCount = 3;
}
private void loadBoxes()
{
for (int x = 0; x < boxCount; x++)
{
if (tbox[x].Text == "")
tbox[x].Text = "0";
}
}
modified 28-Dec-12 12:43pm.
|
|
|
|
|
No. There's nothing like that in .NET at all. C# is not an interpreted language so it's impossible to evaluate a string at run-time and treat it as code. It has to be compiled in order to work.
You've have to use Reflection to get the control using a string like that and get it's value. Though, you may want to think twice about doing this at all as Reflection isn't exactly speedy to use.
The other problem is that are you seriously calling your controls Textbox1, Textbox2, ...?? That's horrible as you have no idea what each textbox is used for.
|
|
|
|
|
OK. Thanks Dave. That clears it up. The text box values are not of consequence but if they are null it is a problem. Trying to add them to a listbox is rejecting null strings. Position in the list box is critical for each item added so a place holder needs to be added.
|
|
|
|
|
Textbox.Text will never return null, though it can be an empty string. Those terms mean very different things, so don't confuse people (or search engines) by using them incorrectly.
codejuggler9 wrote: Trying to add them to a listbox is rejecting null strings. Position in the list
box is critical for each item added so a place holder needs to be added
Doesn't make any sense to me as it has nothing to do with the original question.
|
|
|
|
|
We have a new requirement that a daily file transfer of client data be encrypted with PGP. I would rather not rely on a blackbox solution, as I want to make sure that the file is not being secretly sent off somewhere.
Can anyone help me find .Net source code to do PGP encryption/decryption? C# or VB.net are both fine, I can work with either. I do not need -- and frankly, would rather avoid -- all of the other bells and whistles that have become common with PGP packages. All I need is file encryption and decryption using an public/private key that follows the PGP protocols.
|
|
|
|
|
I need to sharpen my Google-fu.
After trying a few searches, up pops the latest version of Bouncy Castle[^], issued last year, with C# source code. Thanks anyway.
|
|
|
|
|
Hi,
i am working with C# application, which has some memory leak problem. When i checked with profiler, i saw private bytes are being increased continuously and after some times it is getting crashed. Can any one tell me what is "Private bytes" and what is the main reason of its increase in size without any request .
Thanks,
Nishant
|
|
|
|
|
Without knowing anything at all about your application, this question is impossible to answer.
Is it a Windows Forms app, WPF, ASP.NET, Silverlight, ... What? What does the application do? What is it doing when this "leak" occurs? Is it idle? Is it doing something in the background? Is it using some 3rd party components? What's the error message, if any, when it crashes?
Where are you getting this statistic from? DO NOT USE TASK MANAGER!
|
|
|
|
|
nishantenet wrote: without any request .
Obviously one thing is apparent - something is still running.
So figuring out what is running might lead to a solution and at worse would at least localize where the problem is.
|
|
|
|
|
Hi,
I am using MSI to create setup. I already added prerequisite (.NET framwork 3.5) into MSI.
I have selected option i.e. Download prerequisite fromthe same location as my application
While installing setup on windows XP SP3 its showing error .NET framework is not installed on the machine. Setup is not installing .NET framework from MSI.
Even I added all framework files and folders into application folder and program files folder.
Is I am doing any wrong? can pls let me know the steps how can i used my prerequisite .NET framework 3.5 on windows XP SP3 even not framework is available.
Thanks
sjs
|
|
|
|
|
If you're using the Setup and Deployment project to create your .MSI, it will NOT install the .NET Framework for you. It MUST be installed before you launch your setup .MSI.
If you use some other install creation app, like InstallShield, that will give you the option of installing the .NET Framework for you.
|
|
|
|
|
Hi All,
I am using EF 1.0 trying to update a column called doc id which is nullable column, but the EF is updating the other column also along with this column. There is no other place that I am updating that column mistakenly.
Is there any way that I can avoid this kind of situation happening. Because it is happening only in Integration Env, but not in Dev. I dont know what to do now. Please help me.
Below is my code which is updating doc id field:
Using _databasefactory As New DatabaseFactory()
Dim context = _databasefactory.DatabaseContext
If Not String.IsNullOrEmpty(temp_doc_id) And Not String.IsNullOrEmpty(doc_id) Then
Dim reqs = (From r In context.requests Where r.claim.claim_no.Equals(claim_no) And r.temp_doc_id.Equals(temp_doc_id)) 'r.empl_accnt_no.Equals(emplacctnumber) and _
Dim i = reqs.Count()
If Constants.EnableLogger And logr IsNot Nothing And Constants.DirectoryExists(Constants.GetLoggerDirectory()) Then
logr.log(1, "Begin RequestEntity : UpdateOrInsertRequestDocId, claim_no, temp_doc_id, i: " + claim_no + ", " + temp_doc_id + ", " + i.ToString())
End If
If Constants.EnableLogger And logr IsNot Nothing And Constants.DirectoryExists(Constants.GetLoggerDirectory()) Then
logr.log(1, "Inserting RequestEntity : UpdateOrInsertRequestDocId emplacctnumber, ManualClaimNo, doc_id, temp_doc_id, request_status, requestreceivedhow: " + _
emplacctnumber + ", " + ManualClaimNo.ToString + ", " + doc_id + ", " + temp_doc_id + ", " + request_status + ", " + requestreceivedhow)
End If
Dim res = 0
If reqs Is Nothing Then
Dim rq = New request()
rq.claim = (From r In context.claims Where r.claim_no.Equals(claim_no)).FirstOrDefault()
rq.empl_accnt_no = emplacctnumber
rq.manual_claim_no = ManualClaimNo
rq.doc_id = doc_id
rq.temp_doc_id = temp_doc_id
rq.request_status = request_status '"OANEW"
rq.request_received_how = requestreceivedhow
rq.last_update_ts = DateTime.Now
rq.created_ts = DateTime.Now
rq.created_by = created_by
rq.last_updated_by = lastupdated_by
rq.comments = String.Empty
context.AddTorequests(rq)
If Constants.EnableLogger And logr IsNot Nothing And Constants.DirectoryExists(Constants.GetLoggerDirectory()) Then
logr.log(1, "Inserting RequestEntity : UpdateOrInsertRequestDocId emplacctnumber, ManualClaimNo, doc_id, temp_doc_id, request_status, requestreceivedhow: " + _
emplacctnumber + ", " + ManualClaimNo.ToString + ", " + doc_id + ", " + temp_doc_id + ", " + request_status + ", " + requestreceivedhow)
End If
Return context.SaveChanges()
ElseIf reqs.Count() <= 0 Then
Dim rq = New request()
rq.claim = (From r In context.claims Where r.claim_no.Equals(claim_no)).FirstOrDefault()
rq.empl_accnt_no = emplacctnumber
rq.manual_claim_no = ManualClaimNo
rq.doc_id = doc_id
rq.temp_doc_id = temp_doc_id
rq.request_status = request_status '"OANEW"
rq.request_received_how = requestreceivedhow
rq.last_update_ts = DateTime.Now
rq.created_ts = DateTime.Now
rq.created_by = created_by
rq.last_updated_by = lastupdated_by
rq.comments = String.Empty
If Constants.EnableLogger And logr IsNot Nothing And Constants.DirectoryExists(Constants.GetLoggerDirectory()) Then
logr.log(1, "Inserting RequestEntity : UpdateOrInsertRequestDocId, emplacctnumber, ManualClaimNo, doc_id, temp_doc_id, request_status, requestreceivedhow: " + _
emplacctnumber + ", " + ManualClaimNo.ToString + ", " + doc_id + ", " + temp_doc_id + ", " + request_status + ", " + requestreceivedhow)
End If
context.AddTorequests(rq)
Return context.SaveChanges()
Else
Dim rq = reqs.FirstOrDefault()
rq.doc_id = doc_id
res = context.SaveChanges()
Return res
End If
End If
End Using
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
HI
I am using Visual Studio 2008 to develop web application in Windows XP Internet explorer-8. If i run first time i wont get any error. In 2nd time i will get Unable to start program http://localhost:1837/default.aspx after that every time it is coming like that. I am not able to get debug point. How to solve this issue.
If anybody knows, please reply me.
thanks in advance.
modified 19-Dec-12 6:13am.
|
|
|
|
|
Try the ASP.NET forum[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I have an application that looks at the system time and records the datetime. We give out demos and license by time.
One customer claims to have blocked my application from seeing the time so it always runs. He wouldn't say how but just said he would "not let it look at the time." Before I dig into this has anyone heard of this or know how to do it? He's not really a hacker but is tech savy enough to find things other people have done.
|
|
|
|
|
Without knowing how you are looking at the time it's impossible to guess how he is blocking it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I'm just using
DateTime.Now.ToUniversalTime()
|
|
|
|
|
Have a look at: http://www.nirsoft.net/utils/run_as_date.html[^]
It hooks the API calls to read the system clock and returns a specified date/time to a particular program.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This is blocked at work but I'll take a look at it when I'm at home. Thanks,
|
|
|
|
|
At the min, any user can book a holiday for ay employee,
I have added [Authorization] to the controllers, and @if (User.Identity.IsAuthenticated)
in the layout so only logged in users can view the pages. But how can I go about only allowing users to book a holiday for them selves
something like if loggedInUserID(is this assigned automatically when a user is created?) =currentPersoID, although this is only a guess and I would prob have to assign the same loggedInUserID to personID.
any suggestions?
Thanks
|
|
|
|
|
This is still not the ASP.NET forum.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
So at the top of my controllers i've added in [Authorize], So far so good only logged in users can access these pages (Person and Holiday)
However the tabs in the homeController which navigate the users to these pages are still displayed...coming from the layout.cs
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Person", "Index", "Person")</li>
<li>@Html.ActionLink("Holidays", "Index", "Holidays")</li>
How can I only get these tabs to display if a user is logged in.
I have tried the approach of adding in a bool in the AccountController.cs
else
{
loggedIn = true;
return RedirectToAction("Index", "Home");
}
}
else
{
loggedIn = false;
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
but then how do I access this from the layout.cs?
Is this the correct approach. Please advise. thanks
|
|
|
|
|