|
mkalantri wrote: Let me know how to avoid resize of the image.
Why, are we married, all of a sudden?
I are troll
|
|
|
|
|
Hello Forum
I wonder if what I can do this.
I have an application in C# that should be able to work in multiple languages, this is ok, but I have issue with combo boxes, I will try to explain.
I have a combo box bound to a database the column name is Color, based on the color the user choose the program will do something else i.e. if the user choose Black method A will be executed if the user choose Yellow method B will be executed.
So I am setting the comboBox1.DataSource, comboBox1.DisplayMember and comboBox1.ValueMember,
But when I am using another language I need the combo box options displayed to the user should be ‘Noir’ (for black) and ‘Jaune’ (for yellow) however the value save to the database should always be the English word.
Can it be done? And if yes, how?
Please Help.
Thank you very much
|
|
|
|
|
Set the DisplayMember to the thing you want displayed, Set the ValueMember to the thing you want stored in the database.
You will probably have to store all the translations in the database too and provide a lookup table (with the value you want to store [the English word], the language, the localised value [the French/German/Spanish/etc. word]) and join that lookup table to the query you are currently using with the additional filter of the language you want to display.
|
|
|
|
|
hi
is it poosible to make toolbox of buutons
if yes how can i make control for it
|
|
|
|
|
What about the ToolStrip control[^]? (Assuming you use Winforms)
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi. i have a problem which i just cannot solve. i have created a crystal report
with dynamic parameters , values are fetched from the database. it works fine when i run the report inside crystal reports 2008.
but when i run the report in my software, visual studio 2005, C# (with crystal reports 2008 offcourse)
i cannot get the list of values. if i add a static list of values it shows up just fine.
so this:
foreach ( ParameterField pf in m_ReportDocument.ParameterFields)
{
MessageBox.Show(pf.DefaultValues.Count.ToString());
}
shows "5" if i add five static values, but "0" if i add dynamic values.
Any suggestions?
m_reportdocument is a crystal report document. the rtp is loaded and datasources are set.
I've tried googling and searching business objects forums. i have seen the question but no replies.
Cheers // Tomas
If it' stuck, DO NOT pull harder!
|
|
|
|
|
I am designing a scheduler, for one module i need a little assistance
My class is as
public class CHandset
{
public int HandsetId
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public int LocationId
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public Queue<t> Queue
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public int ObjState
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public int ObjDBLogging
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public int RequeueTime
{
get
{
throw new System.NotImplementedException();
}
set
{
}
}
public void Execute()
{
throw new System.NotImplementedException();
}
}
</t>
The above is a class for a handset.
There may be 20 handsets over the entire network. Every handset object will have its queue.
1. Objects of this class will be made on fly
2. Queue will contain the jobs that the handset needs to fire.
3. Every instance of the handset object will fire itself in thread.
I want to know that how can i write a code that can access the Queue of object.
I have thought in mind that if i use MSMQ, will it solve my problem.
|
|
|
|
|
Here's a novel idea, have a crack at your own homework, and when you hit a specific problem then ask a question, including the code you've implemented, and im sure someone will help you out.
|
|
|
|
|
All the setters run fine, what more do you want?
|
|
|
|
|
Amandeep Singh Bhullar wrote: will fire itself in thread
Self(Fired)
I are troll
|
|
|
|
|
Hi ALL.
I want the GMT time from current system date time in c#.net.How can i do this is there nay function
|
|
|
|
|
Take a look at this[^].
You should try the r,R and S format specifiers.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
can u give an example for .net 1.1
|
|
|
|
|
Hi,
have a look at DateTime.UtcNow
|
|
|
|
|
thanks for reply
i had DateTime.UtcNow.ToUniversalTime().ToString("r") it gives
value like "Fri, 09 Jan 2009 07:53:44 GMT"
can i get it accordance with Indian time i.e. +5.30 GMT
|
|
|
|
|
Hi,
the ones you can get easily are local time (DateTime.Now) and GMT time (DateTime.UtcNow).
all others must be available as well, I suggest you have a look at DateTime.ToString(IFormatProvider),
I never used it though.
I hope there isn't a law against reading the documentation where you live.
|
|
|
|
|
I wonder why you convert so much - DateTime.UtcNow.ToString() should be enough. You can subtract DateTime.Now from DateTime.UtcNow and you will get a TimeSpan that has the difference.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
tauras81 wrote: i had DateTime.UtcNow.ToUniversalTime().ToString("r") it gives
value like "Fri, 09 Jan 2009 07:53:44 GMT"
That's GMT.
tauras81 wrote: Indian time i.e. +5.30 GMT
Isn't that your local system time? (meaning, GMT+5.5?)
I are troll
|
|
|
|
|
Hi,
I have 2 forms, (frm_main and frm_meter)
frm_main has a menuStrip control with a New File menu, When I click the menu i create a new variable (meter_control) of type frm_meter and execute meter_control.show(); The problem arrises when I click once on the menu, then I close the meter_control form and then click again. and then The error "Windows has triggered a breakpoint" shows...
here is the code
Public frm_main()
{
InitializeComponent();
this.menuStrip_newFile.Click += new EventHandler(menuStrip_newFile_click);
}
private void menuStrip_newFile_click(object sender, EventArgs e)
{
frm_meter meter_control = new frm_meter();
meter_control.Show(); // Here it sets the green breakpoint - the second time I try to create this variable after just closing it
}
The total error description is:
Windows has triggered a breakpoint in micro_param.exe.
This may be due to a corruption of the heap, and indicates a bug in micro_param.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
In the output window this is written: "HEAP[micro_param.exe]: HEAP: Free Heap block ff2028 modified at ff205c after it was freed"
PS. I do not load any of DLL-s
Thanks.
|
|
|
|
|
is frm_meter a static class?
add some error handling:
private void menuStrip_newFile_click(object sender, EventArgs e)
{
try{
frm_meter meter_control = new frm_meter();
meter_control.Show();
} catch (Exception ee) {
MessageBox.Show(ee.message);
}
}
atleast you should get a better error message.
br
Tomas
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Hi Guys. I have now searched the Web and can't seem to find the exact solution for my problem. I am trying to process a file of just over 2gb in size. File contains 879 987 lines of data.
I am using the FileHelpers library to read the file, search for specific values and then writing other data from the file out to a new file.
MY problem is that It takes a few hours to read the file and I have to abort the job. Is there a better way of doing this? I have resorted to writing a splitter to split the file into smaller chunks and then processing the smaller 20+ files which is much faster but also takes a bit of time to do.
Can anybody please advise of a better or faster way of reading the one big file and doing what I am doing below??
string filePath;
filePath = txtBoxSelectFile.Text;
FileHelperEngine<IvalueRev> engine = new FileHelperEngine<IvalueRev>();
engine.ErrorManager.ErrorMode = ErrorMode.SaveAndContinue;
IvalueRev[] res = engine.ReadFile(filePath);
if (engine.ErrorManager.ErrorCount > 0)
engine.ErrorManager.SaveErrors(@"C:\Errors.txt");
StreamWriter sw = new StreamWriter(filePath + ".txt");
foreach (IvalueRev rev in res)
{
if (rev.Flag == "2" || rev.Flag == "4" || rev.Flag == "5" || rev.Flag == "6" || rev.Flag == "7" || rev.Flag == "8" || rev.Flag == "9")
{
sw.WriteLine(rev.HID.ToString() + "\t" + rev.Flag.ToString());
}
}
sw.Close();
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
the way I see it, your app would run much faster without the "FileHelperEngine".
Reading a 2GB file should take a couple of minutes, and no more.
The trouble with your "helper" class is it insists on processing the file as a whole, since it
returns an array of all the lvalueRev objects, whereas you only need them sequentially, as shown
by your foreach loop.
Hence I suggest you write some more code to read the file yourself, getting one lvalueRev out of it
at a time, dramatically reducing the memory load (and possible memory paging) the original is causing.
|
|
|
|
|
Thanks Luc. I will look into this. I wrote another simple line counter counting the lines in the same file and that runs for about 4minutes. I am just not sure how to "search the file for specific values at specified offsets but will look this up. Below the simple counter I wrote earlier. I guess it should work on the same principle, correct??
string filePath;
filePath = textBox1.Text;
int totalRows = 0;
Stream stream = new FileStream(filePath, FileMode.Open);
BufferedStream bstream = new BufferedStream(stream);
StreamReader reader;
String line;
reader = new StreamReader(bstream);
while((line = reader.ReadLine()) != null)
{
totalRows++;
}
stream.Close();
MessageBox.Show("Total NUmber of Records in the File: " + totalRows.ToString());
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
the code shown is fine.
I do not know what your file looks like, nor what you mean exactly by "search the file for specific values at specified offsets".
You will get linear performance (twice as big takes twice as long, and no more) as long as you can solve your problem while reading the file sequentially without memorizing it all. So if you know in advance you need specific lines (say by line numbers), then sort the line numbers, read the file sequentially and check the current line number with the next one of interest.
If your offsets are byte offsets relative to the file's origin, then you could still loop while reading
lines as you did, and ask the stream for the current position, and act accordingly. This will work just
fine as long as you don't need to move backwards; again, you may need to sort the offsets first
(I am hoping you get all the offset values at the same time, otherwise you would not be able to sort them).
|
|
|
|
|
you can just pass the filepath straight to stream reader.
if you want to look for offsets then have a byte counter and read bytes in from file
i.e.
StreamReader sr = new StreamReader("C:\\File.txt");
int b = sr.BaseStream.ReadByte();
long Count = 1;//for read byte
while(b != -1)
{
if(Count == OffsetValue)
//Do something
Count++;
b = sr.BaseStream.ReadByte();
}
sr.Close();
|
|
|
|