Click here to Skip to main content
15,891,372 members
Home / Discussions / C#
   

C#

 
AnswerRe: DataGridView,DataBind() Pin
led mike27-Apr-09 9:10
led mike27-Apr-09 9:10 
Questionlooking for a piece of wire or sample to convert voice from microphone to a Oscilloscope [modified] Pin
dinbrca3527-Apr-09 8:03
dinbrca3527-Apr-09 8:03 
GeneralRe: looking for a algorithem or sample to convert voice from microphone to a Oscilloscope Pin
OriginalGriff27-Apr-09 8:15
mveOriginalGriff27-Apr-09 8:15 
Questionusing file. Pin
jaraldumary27-Apr-09 7:50
jaraldumary27-Apr-09 7:50 
AnswerRe: using file. Pin
0x3c027-Apr-09 8:06
0x3c027-Apr-09 8:06 
GeneralRe: using file. Pin
OriginalGriff27-Apr-09 8:17
mveOriginalGriff27-Apr-09 8:17 
GeneralRe: using file. Pin
0x3c027-Apr-09 8:38
0x3c027-Apr-09 8:38 
QuestionConvert Time Pin
onetreeup27-Apr-09 7:15
onetreeup27-Apr-09 7:15 
I am trying to convert clock time to a double, and am getting an error, can someone use another pair of eyes to assist with this. See the code below. Thanks

static void Main(string[] args)
{
string[] timeArray = new string[6]{ "08:17", "15:26", "18:32", "00:46", "10:38", "13:56" };

double[] decTimeArray = new double[6];
for (int x = 0; x < timeArray.Length; x++)
{
decTimeArray[x] = ConvertTime(timeArray[x]);
}

for (int x = 0; x < timeArray.Length; x++)
{
Console.WriteLine(timeArray[x] + " " + decTimeArray[x]);
}
Console.ReadKey();
}
}

public static double ConvertTime(string rawTime)
{

int hours;
int minutes;
double dminutes;
double decimalTime;

string delimStr = ":";
char[] delimiter = delimStr.ToCharArray();
string[] split;
split = rawTime.Split(delimiter);
hours = Convert.ToInt32(split[0]);
minutes = Convert.ToInt32(split[1]);

if (minutes < 7)
dminutes = 0.00;
else if (minutes < 22)
dminutes = 0.25;
else if (minutes < 37)
dminutes = 0.50;
else if (minutes < 53)
dminutes = 0.75;
else dminutes = 1.0;
return decimalTime = dminutes + hours;
AnswerRe: Convert Time Pin
Luc Pattyn27-Apr-09 7:42
sitebuilderLuc Pattyn27-Apr-09 7:42 
GeneralRe: Convert Time Pin
harold aptroot27-Apr-09 7:42
harold aptroot27-Apr-09 7:42 
AnswerRe: Convert Time Pin
onetreeup27-Apr-09 7:58
onetreeup27-Apr-09 7:58 
GeneralRe: Convert Time Pin
harold aptroot27-Apr-09 8:04
harold aptroot27-Apr-09 8:04 
GeneralRe: Convert Time Pin
Luc Pattyn27-Apr-09 8:10
sitebuilderLuc Pattyn27-Apr-09 8:10 
GeneralRe: Convert Time Pin
harold aptroot27-Apr-09 8:20
harold aptroot27-Apr-09 8:20 
GeneralRe: Convert Time Pin
agent00zelda27-Apr-09 8:19
agent00zelda27-Apr-09 8:19 
GeneralRe: Convert Time Pin
onetreeup27-Apr-09 8:28
onetreeup27-Apr-09 8:28 
QuestionMilitary time project Pin
blskv27-Apr-09 6:59
blskv27-Apr-09 6:59 
AnswerRe: Military time project Pin
Guffa27-Apr-09 7:32
Guffa27-Apr-09 7:32 
GeneralRe: Military time project Pin
Luc Pattyn27-Apr-09 7:44
sitebuilderLuc Pattyn27-Apr-09 7:44 
GeneralRe: Military time project Pin
OriginalGriff27-Apr-09 8:14
mveOriginalGriff27-Apr-09 8:14 
AnswerRe: Military time project Pin
harold aptroot27-Apr-09 7:40
harold aptroot27-Apr-09 7:40 
AnswerRe: Military time project Pin
Ennis Ray Lynch, Jr.27-Apr-09 8:22
Ennis Ray Lynch, Jr.27-Apr-09 8:22 
Question3D data visualization Pin
ehsan salehi27-Apr-09 6:47
ehsan salehi27-Apr-09 6:47 
GeneralRe: 3D data visualization Pin
harold aptroot27-Apr-09 7:41
harold aptroot27-Apr-09 7:41 
GeneralRe: 3D data visualization Pin
ehsan salehi27-Apr-09 19:29
ehsan salehi27-Apr-09 19:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.