|
I have three tables related in the following way
TABLE1:
<font color="#ff0000">ID (PK)</font>
NAME
<hr>
TABLE2:
<font color="#00ff00">ID (PK)</font>
NAME
<font color="#ff0000">TABLE1_ID(FK)</font>
<hr>
TABLE3:
ID (PK)
NAME
<font color="#00ff00">TABLE2_ID (FK)</font></hr></hr>
How do you populate them in a tree view, I wrote some bad nested loop that I dont want you to see and get confused
Please help me with your clear logic!
Thanks guys!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
If your ugly nested code works, just go with it. Sometimes, ugly nested code is the only way.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanx, but do you all do it that way?? I mean using ugly nested loops?? I really wanna see how others do it!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I don't understand when someone comes along and doesn't understand that a little work is involved in getting things done. Many times, the ugliness of the code is directly proportional to the difficulty in its implementation. Remember, if it works and you're on a release schedule, button up the code and move on.
Without seeing your code and being made privy to ALL of the requirements, we can't possibly help you improve it.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Ok, thanks John, I'm happy with it now and this's how it looks:
private DataTable GenDT(string strSelect)
{
DataTable _dt = new DataTable();
new OracleDataAdapter(strSelect, oraCONNECTION).Fill(_dt);
return _dt;
}
private void Populate_treeView1()
{
DataTable dt1, dt2, dt3;
int ID;
string sep, seperator;
sep = ":";
#region Table1
dt1 = GenDT("SELECT * FROM Table1");
for (int x = 0; x < dt1.Rows.Count; x++)
{
ID = int.Parse(dt1.Rows[x]["ID"].ToString());
Name = dt1.Rows[x]["NAME"].ToString();
treeView1.Nodes.Add(Name + sep + ID.ToString(), Name);
#region Table2
dt2 = GenDT("SELECT * FROM Table2 WHERE T2_Table1_ID = " + ID);
for (int y = 0; y < dt2.Rows.Count; y++)
{
ID = int.Parse(dt2.Rows[y]["ID"].ToString());
Name = dt2.Rows[y]["NAME"].ToString();
treeView1.Nodes[x].Nodes.Add(Name + sep + ID.ToString(), Name);
#region Table3
dt3 = GenDT("SELECT * FROM Table3 WHERE T3_Table2_ID = " + ID);
for (int z = 0; z < dt3.Rows.Count; z++)
{
ID = int.Parse(dt3.Rows[z]["ID"].ToString());
Name = dt3.Rows[z]["NAME"].ToString();
treeView1.Nodes[x].Nodes[y].Nodes.Add(Name + sep + ID.ToString(), Name);
}
#endregion
}
#endregion
}
#endregion
treeView1.ExpandAll();
}
Thanks for your time!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
I want to set values in Vista registry (in UAC enabled mode) on this (HKEY_LOCAL_MACHINE\SOFTWARE\MyFolder) path but the values are set on diffrent (HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\MyFolder) path.
How to set values in that (HKEY_LOCAL_MACHINE\SOFTWARE\MyFolder) path if UAC is enabled.
Plz help me
|
|
|
|
|
You can't write to (or edit) keys under HKEY_LOCAL_MACHINE unless you're in the administrator group.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Embed a manifest in your application to make it run as administrator.
|
|
|
|
|
how to change the shape of forms like circle,elipse etc.,
|
|
|
|
|
Sounds like the title of a book. When are you going to write it?
I googled it, and got a bunch of applicable search results. Try it yourself.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Create A Region of Shape that You want (like Circle, Elipse, Polygon etc..)
Asign the Region To your From by
Form1.Region=mynewRegion;
Hope this will help you going forword . Now try to do it yourself
cheers,
Abhijit
|
|
|
|
|
|
search for sample code here in codeproject
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TBBUTTON
{
public Int32 iBitmap;
public Int32 idCommand;
public byte fsState;
public byte fsStyle;
public byte bReserved1;
public byte bReserved2;
public UInt32 dwData;
public IntPtr iString;
};
const int BUFFER_SIZE = 0x4096;
var localBuffer = new byte[BUFFER_SIZE];
UInt32 processId;
var tbButton = new TBBUTTON();
IntPtr hDesktop = User32.GetDesktopWindow();
IntPtr hTray = User32.FindWindowEx( hDesktop, IntPtr.Zero, "Shell_TrayWnd", null );
IntPtr hReBar = User32.FindWindowEx(hTray, IntPtr.Zero, "TrayNotifyWnd", null);
IntPtr hTask = User32.FindWindowEx(hReBar, IntPtr.Zero, "SysPager", null);
IntPtr hToolbar = User32.FindWindowEx( hTask, IntPtr.Zero, "ToolbarWindow32", null );
UInt32 threadId = User32.GetWindowThreadProcessId(hToolbar, out processId);
IntPtr hProcess = Kernel32.OpenProcess(ProcessRights.ALL_ACCESS, false, processId);
IntPtr ipRemoteBuffer = Kernel32.VirtualAllocEx(hProcess, IntPtr.Zero, new UIntPtr(BUFFER_SIZE),
MemAllocationType.COMMIT, MemoryProtection.PAGE_READWRITE);
fixed (TBBUTTON* pTBButton = &tbButton)
{
var ipTBButton = new IntPtr(pTBButton);
var b = (int) User32.SendMessage(hToolbar, TB.GETBUTTON, (IntPtr) 1, ipRemoteBuffer);
bool b2 = Kernel32.ReadProcessMemory(hProcess, ipRemoteBuffer, ipTBButton,new UIntPtr((uint) sizeof(TBBUTTON)), IntPtr.Zero);
Console.WriteLine(tbButton.dwData + " dwData" );
}
Hello all ,
Am having a problem with TBBUTTON struct in Vista X64.
Am trying to get the dwData (tbButton.dwData) Value from each button, so i can later readProcessMemory of the button, and in vista x64 sp1 it return me always 0x00000... .
In windows XP x86 , works just fine.
Any ideas?
Thanks
|
|
|
|
|
Decad wrote: Am having a problem with TBBUTTON struct in Vista X64
TBBUTTON looks like this
typedef struct _TBBUTTON {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
#ifdef _WIN64
BYTE bReserved[6];
#elif defined(_WIN32)
BYTE bReserved[2];
#endif
DWORD_PTR dwData;
INT_PTR iString;
} TBBUTTON, NEAR* PTBBUTTON, *LPTBBUTTON;
typedef const TBBUTTON *LPCTBBUTTON;
which doesn't match your structure.
Also, I'm pretty sure the packing isn't 1.
Try
[StructLayout(LayoutKind.Sequential)]
internal struct TBBUTTON
{
public Int32 iBitmap;
public Int32 idCommand;
public byte fsState;
public byte fsStyle;
public byte bReserved1;
public byte bReserved2;
<code>public byte bReserved3;
public byte bReserved4;
public byte bReserved5;
public byte bReserved6;</code>
public <code>IntPtr</code> dwData;
public IntPtr iString;
};
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you.
Wrong msdn link from google,
I was watching Windows CE struct ->http://msdn.microsoft.com/en-us/library/ms940418.aspx
and not -> http://msdn.microsoft.com/en-us/library/bb760476(VS.85).aspx
|
|
|
|
|
I hate when that happens.
I've complained about not being able to filter out
the CE docs for a long time.
Did that struct work? I didn't test it so I was pretty much guessing
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yea it worked fine
Thanks for your time
|
|
|
|
|
Decad wrote: Yea it worked fine
Cool! Good to know.
Cheers
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
we developed a .NET-UserControl and embedded it into a C++-application as an ActiveX via interop. It is placed at an MFC CView-derived class. The problem is that the ActiveX has drawing problems: it is not refreshed quite often, for example when a modal dialog is opened by clicking on a button on the CView and then closed. When you hide the main window and then show it, the ActiveX will be properly displayed again. Thus, it seems like the typical invalidate-problem, the control doesn't get WM_PAINT.
Some tests revealed that the child-controls of the UserControl are actually not redrawn. I overrode the UserControl's OnPaint() to draw a rectangle - after opening the modal dialog and then closing it, the rectangle is still visible on the screen. But the other child windows are not.
Do you have any idea what could be the cause of this strange behavior?
Greetings,
Steven
|
|
|
|
|
Hi!
I want the coding to insert an image in Word document on a button click using c# in Windows Application..
|
|
|
|
|
|
Hi,
Just guide me through this:
I created a Crystal Report File and a Dataset File (design mode not code).
I want to fill crystal report with data from a database like i do to a Datagridview (have store_procedures for that).
Ok, what i see is that here dataset works like a suit, and as to fit/match my data from database, right?!
Dont i have to do anything else to the dataset fields i add in report design?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Workflow should be like this:
at design time
- add the dataset as a source for the report
- add desired fields to the report
at run time
- populate the dataset
- run the report and show preview (or print or save if that's what you want).
There are several good tutorials on msdn like this one: Tutorial: Connecting to ADO.NET DataSets[^]
The need to optimize rises from a bad design
|
|
|
|
|
My problem is as follows. I'm using a delegate in C# as a callback function for the unmanaged dll. When the delegate returns I get the following error.
Debug Error!
Module:
File: i386\chkesp.c
Line: 42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
When I run my C# code in a debugger the delegate gets called and everything looks great until the the function returns then I get the above error. I can even ignore it and continue but then I get the error again each time the callback function is used.
The function prototype in the C++ dll looks like...
DllImpExp int PcDllInit(const char PcDllPwd[64], int AutoDeleteFlag,
int LogFlag,
void (PcMsgCb)(PC_MSG_TYPE PcMsgType,
const char MsgTgt[MAX_PCDLL_STRING_LEN],
int Verbosity,
const char Msg[512]));
My Dllimport in the C# app is...
[DllImport("Dll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern Int32 PcDllInit(char[] PcDllPwd,
Int32 AutoDeleteFlag,
Int32 LogFlag,
CallBackDelegate PcMsgCb);
And finally the delegate being used as a callback function
delegate void CallBackDelegate(PC_MSG_TYPE PcMsgType,
char[] MsgTgt,
int Verbosity,
char[] Msg);
I feel like the problem might be the signature's of either my delegate or in the DllImport but i'm at a loss here. Any help on this would be great. Thanks in advance and let me know if you need any other information from me.
|
|
|
|