Tag archive for ‘c’

C# Random Number Generator, MessageBox

Question:
I need to write a program that generates 100 random numbers between 0 and 1000, displaying the number of even values generated as well as the smallest, largest, and the range of values. The output has to be displayed in a Windows message box.
I am new to C# and this is a bit over my [...]

how to get the max value from array of objects

Question:
HI experts
for(int i=0;i<lineDetails.datecodeBasics.length;i++)
{
}
Explanation of above code
DateCodeBasics[] datecodebasic
Here datecodeBasics is a object array of type Datecodebasics.
This object contains itemdatecode(nothing but date) as a property
I need to get the max date and mindate from the datecodebasics object collection.
maxdate is nothing but enddate
mindate is nothing but  start date
Solution:
To use Sort on an array of objects of type DateCodeBasics, [...]

Friendly URL Management

Question:
Hi There
I have created an admin section that allows admin users to specify a URL then add 2 possible friendly URL for that specific URL and save it in the DB.
I have done it this way as the site is built dynamically and alot of the content is managed in the admin section.
Also the friendly [...]

how to change (or focus) the background color of selected menu item in asp.net

Question:
I have taken a master page. in this I have taken an ajax accordian control. In this i have declared   menu control. Now, I want that when a user select a particular item in the sub menu, then its background color get changed. I do not have any idea. plz help me on this. For [...]

Can we assign a CSS class to all dropdowns in one shot in asp.net C#?

Question:
Hi,
I want to apply a CSS class to all dropdowns in all the pages of my project in one shot.
How can we achieve this?
Solution:
Hi meetpd,
To set a css class for all droopdowns  in one shot, u can use the javascript.
What u need to do is,
1. Get all the controls in the page.
2. Loop through all [...]

Sequential file

Question:
I want to modify my program to use an array for the mortgage information and read the interest rates and other information into an array read from a sequential file. This is my first time working with a sequential file. Below is the code I want to use.
Code Snippet:
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include <ctime>
#include “Mort4.h”
using [...]

Use Timer in C# COM+ Application

Question:
Can I use timer in C# COM+ application (Which runs as NT service as well)?
If it is possible please let me know, if not please let me know the alternative way of getting timer functionality in COM + Application.
Solution:
windows timer control does not work in windows service.. this the work arround tht i have used…
using [...]

C# Event Listener Problem

Question:
Hi Experts,
Everytime I change my code and compile again in C# (.Net Studio) , my eventlisteners are gone. I have to put it back . Is there a way how to prevent this?
Solution:
Instead of specifying the event handlers in designer file, specify them in the code file in the constructor, after InitializeComponent is called.
Thanks,
Swaps…

C# Question

Question:
True or False?
The System.Int32.TryParse method will throw an exception to the caller if the text to be parsed contains characters or formatting that are illegal for an integer.
Solution:
The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion fails. It eliminates the need to use exception [...]

How do I use libvlc and v4l2 to stream video in c++ on Linux

Question:
I am currently designing a video server as well as a .Net managed library as an SDK for other programmers to use in interfacing with it. The communication between the SDK and the server application is all done through standard socket programming (easy by the way).
Anyhow, after much research I decided; why reinvent the wheel, [...]